Moving to NIV and massive refactoring
This commit is contained in:
parent
4bcca30c99
commit
14f870f4af
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,9 +0,0 @@
|
||||
[submodule "imports/github/rycee/home-manager"]
|
||||
path = imports/github/rycee/home-manager
|
||||
url = https://github.com/rycee/home-manager.git
|
||||
[submodule "imports/github/michael-ball/base16-horizon-scheme"]
|
||||
path = imports/github/michael-ball/base16-horizon-scheme
|
||||
url = https://github.com/michael-ball/base16-horizon-scheme.git
|
||||
[submodule "imports/github/nana-4/materia-theme"]
|
||||
path = imports/github/nana-4/materia-theme
|
||||
url = https://github.com/nana-4/materia-theme
|
@ -12,13 +12,14 @@
|
||||
# 3. Log in to application and services where neccesary
|
||||
|
||||
|
||||
device: # This is the device we're on now
|
||||
device:
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
let sources = import ./nix/sources.nix;
|
||||
in {
|
||||
imports =
|
||||
[
|
||||
/etc/nixos/hardware-configuration.nix
|
||||
./imports/github/rycee/home-manager/nixos
|
||||
"${sources.home-manager}/nixos"
|
||||
./modules
|
||||
];
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 644d073863ba9f863eef3b88a8f8607d0ace0063
|
@ -1 +0,0 @@
|
||||
Subproject commit b1e4c563146ae34fff6a697393b6a1bc66b612f5
|
@ -1 +0,0 @@
|
||||
Subproject commit 95c8007b8fe4433cd217db83ce26b8e29875ba06
|
@ -24,6 +24,7 @@ in {
|
||||
bc
|
||||
sysstat
|
||||
xdotool
|
||||
niv
|
||||
|
||||
lxqt.pavucontrol-qt
|
||||
bibata-cursors
|
||||
@ -35,7 +36,6 @@ in {
|
||||
# Utils
|
||||
pciutils
|
||||
usbutils
|
||||
nix-prefetch-git
|
||||
hdparm
|
||||
vdpauinfo
|
||||
libva-utils
|
||||
@ -81,20 +81,20 @@ in {
|
||||
];
|
||||
|
||||
home-manager.users.alukard.home.packages = with pkgs; [
|
||||
nix-zsh-completions
|
||||
qbittorrent
|
||||
# vscodium
|
||||
vscode
|
||||
# vscode-with-extensions
|
||||
xarchiver
|
||||
tdesktop
|
||||
spotifywm
|
||||
discord
|
||||
pulseeffects
|
||||
] ++ lib.optionals (!isVM) [
|
||||
steam
|
||||
steam-run
|
||||
protontricks
|
||||
retroarch
|
||||
# retroarch
|
||||
] ++ lib.optionals (enableDocker) [
|
||||
docker-compose
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,6 @@ stdenv.mkDerivation rec {
|
||||
src = myScript;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ./bin/wg-conf $out/bin/wg-conf
|
||||
mv ./bin/wg-conf $out/bin/wg-conf
|
||||
'';
|
||||
}
|
19
modules/applications/xonar-fp.nix
Normal file
19
modules/applications/xonar-fp.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ stdenv, pkgs }:
|
||||
let
|
||||
xonar-fp = pkgs.writeShellScriptBin "xonar-fp" ''
|
||||
CURRENT_STATE=`amixer -c 0 sget "Front Panel" | egrep -o '\[o.+\]'`
|
||||
if [[ $CURRENT_STATE == '[on]' ]]; then
|
||||
amixer -c 0 sset "Front Panel" mute
|
||||
else
|
||||
amixer -c 0 sset "Front Panel" unmute
|
||||
fi
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "xonar-fp";
|
||||
src = xonar-fp;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv ./bin/xonar-fp $out/bin/xonar-fp
|
||||
'';
|
||||
}
|
@ -34,6 +34,6 @@ stdenv.mkDerivation rec {
|
||||
src = myScript;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ./bin/yt-mpv $out/bin/yt-mpv
|
||||
mv ./bin/yt-mpv $out/bin/yt-mpv
|
||||
'';
|
||||
}
|
@ -1,39 +1,35 @@
|
||||
{ config, lib, ... }: {
|
||||
imports = [
|
||||
./applications/packages.nix
|
||||
# ./applications/vivaldi
|
||||
./workspace/i3blocks
|
||||
./workspace/i3
|
||||
./workspace/zsh.nix
|
||||
./workspace/rofi.nix
|
||||
./workspace/gtk.nix
|
||||
# ./workspace/compton.nix
|
||||
./workspace/misc.nix
|
||||
./workspace/dunst.nix
|
||||
./workspace/mpv.nix
|
||||
./workspace/kde
|
||||
./workspace/locale.nix
|
||||
./workspace/fonts.nix
|
||||
./workspace/light.nix
|
||||
./workspace/xresources.nix
|
||||
./workspace/barrier.nix
|
||||
./workspace/podman.nix
|
||||
./workspace/direnv.nix
|
||||
./themes.nix
|
||||
./mullvad.nix
|
||||
./applications.nix
|
||||
./secrets.nix
|
||||
./devices.nix
|
||||
./packages.nix
|
||||
./nix.nix
|
||||
./users.nix
|
||||
./hardware.nix
|
||||
./services.nix
|
||||
./power.nix
|
||||
./xserver.nix
|
||||
./network.nix
|
||||
./wireguard.nix
|
||||
./filesystems.nix
|
||||
./hardware.nix
|
||||
./network.nix
|
||||
./packages.nix
|
||||
./power.nix
|
||||
./samba.nix
|
||||
./secrets.nix
|
||||
./services.nix
|
||||
./themes.nix
|
||||
./users.nix
|
||||
./wireguard.nix
|
||||
./xserver.nix
|
||||
|
||||
./applications/packages.nix
|
||||
|
||||
# ./workspace/barrier.nix
|
||||
./workspace/dunst.nix
|
||||
./workspace/fonts.nix
|
||||
./workspace/gtk.nix
|
||||
./workspace/i3
|
||||
./workspace/i3blocks
|
||||
./workspace/kde
|
||||
./workspace/light.nix
|
||||
./workspace/locale.nix
|
||||
./workspace/misc.nix
|
||||
./workspace/mpv.nix
|
||||
./workspace/rofi.nix
|
||||
./workspace/xresources.nix
|
||||
./workspace/zsh.nix
|
||||
];
|
||||
}
|
||||
|
@ -14,19 +14,16 @@ with types; {
|
||||
isLaptop = (!isNull (builtins.match ".*Laptop" device));
|
||||
isVM = (!isNull (builtins.match ".*VM" device));
|
||||
smallScreen = (device == "Dell-Laptop");
|
||||
isHost = (device == "AMD-Workstation");
|
||||
isShared = devInfo.isShared;
|
||||
cpu = devInfo.cpu.vendor;
|
||||
video = devInfo.video;
|
||||
isSSD = devInfo.drive.type == "ssd";
|
||||
# isGaming = (isNull (builtins.match ".*VM" device));
|
||||
enableDocker = devInfo.enableDocker;
|
||||
hostName = if !isNull devInfo.hostName then
|
||||
devInfo.hostName
|
||||
else
|
||||
device;
|
||||
# goodMachine = devInfo.cpu.clock * devInfo.cpu.cores >= 4000
|
||||
# && devInfo.drive.size >= 100 && devInfo.ram
|
||||
# >= 8; # Whether machine is powerful enough for heavy stuff
|
||||
isHost = (device == "AMD-Workstation");
|
||||
};
|
||||
|
||||
devices = {
|
||||
|
@ -1,51 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.networking.mullvad;
|
||||
in {
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
networking.mullvad = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
This option enables mullvad vpn daemon.
|
||||
'';
|
||||
};
|
||||
enableOnBoot = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
When enabled mullvad daemon is started on boot.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ mullvad-vpn openvpn ];
|
||||
boot.kernelModules = [ "tun" ];
|
||||
|
||||
systemd.services.mullvad-daemon = {
|
||||
description = "Mullvad VPN daemon";
|
||||
wantedBy = optional cfg.enableOnBoot "multi-user.target";
|
||||
wants = [ "network.target" ];
|
||||
after = [
|
||||
"network-online.target"
|
||||
"NetworkManager.service"
|
||||
"systemd-resolved.service"
|
||||
];
|
||||
startLimitIntervalSec = 20;
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.mullvad-vpn}/bin/mullvad-daemon -v --disable-stdout-timestamps";
|
||||
Restart = "always";
|
||||
RestartSec = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
networkmanager.enable = false;
|
||||
wireless = {
|
||||
enable = config.deviceSpecific.isLaptop;
|
||||
# driver = "wext";
|
||||
networks.Alukard_5GHz = {
|
||||
pskRaw = "feee27000fb0d7118d498d4d867416d04d1d9a1a7b5dbdbd888060bbde816fe4";
|
||||
priority = 1;
|
||||
@ -24,15 +23,10 @@
|
||||
pskRaw = "6cfdb04f3e2d4279a4651608c9c73277708c67f7f1435b61228ecf00841e5155";
|
||||
priority = 3;
|
||||
};
|
||||
# interfaces = ["wlan0"];
|
||||
userControlled.enable = true;
|
||||
};
|
||||
firewall.enable = false;
|
||||
# usePredictableInterfaceNames = false;
|
||||
hostName = config.deviceSpecific.hostName;
|
||||
|
||||
mullvad.enable = false;
|
||||
};
|
||||
# systemd.services.dhcpcd.serviceConfig.Type = lib.mkForce
|
||||
# "simple"; # TODO Make a PR with this change; forking is not acceptable for dhcpcd.
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
nixpkgs.config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
nix = {
|
||||
useSandbox = true;
|
||||
autoOptimiseStore = config.deviceSpecific.isSSD;
|
||||
optimise.automatic = true;
|
||||
};
|
||||
}
|
@ -1,44 +1,33 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
|
||||
in {
|
||||
imports = import ../nix/sources.nix;
|
||||
mozilla = import imports.nixpkgs-mozilla { };
|
||||
in { pkgs, config, lib, ... }: {
|
||||
nixpkgs.overlays = [
|
||||
moz_overlay
|
||||
(self: old: rec {
|
||||
# nerdfonts = nur.balsoft.pkgs.roboto-mono-nerd;
|
||||
youtube-to-mpv = pkgs.callPackage ./applications/youtube-to-mpv.nix {};
|
||||
wg-conf = pkgs.callPackage ./applications/wg-conf.nix {};
|
||||
podman-compose = pkgs.callPackage ./applications/podman-compose.nix {};
|
||||
xonar-fp = pkgs.writers.writeBashBin "xonar-fp" ''
|
||||
CURRENT_STATE=`amixer -c 0 sget "Front Panel" | egrep -o '\[o.+\]'`
|
||||
if [[ $CURRENT_STATE == '[on]' ]]; then
|
||||
amixer -c 0 sset "Front Panel" mute
|
||||
else
|
||||
amixer -c 0 sset "Front Panel" unmute
|
||||
fi
|
||||
'';
|
||||
})
|
||||
(self: super: {
|
||||
vscode-with-extensions = super.vscode-with-extensions.override {
|
||||
# When the extension is already available in the default extensions set.
|
||||
vscodeExtensions = with super.vscode-extensions; [
|
||||
bbenoist.Nix
|
||||
] ++ super.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "vscode-remote-extensionpack";
|
||||
publisher = "ms-vscode-remote";
|
||||
version = "0.17.0";
|
||||
sha256 = "Dlf9RzNefPilnbezh13C+WAsTJ7GqSCMEhnWhER+u5s=";
|
||||
}
|
||||
];
|
||||
};
|
||||
(self: super:
|
||||
rec {
|
||||
inherit imports;
|
||||
inherit mozilla;
|
||||
|
||||
})
|
||||
youtube-to-mpv = pkgs.callPackage ./applications/youtube-to-mpv.nix { };
|
||||
|
||||
wg-conf = pkgs.callPackage ./applications/wg-conf.nix { };
|
||||
|
||||
i3lock-fancy = pkgs.callPackage ./applications/i3lock-fancy.nix { };
|
||||
|
||||
git-with-libsecret = super.git.override { withLibsecret = true; };
|
||||
|
||||
xonar-fp = pkgs.callPackage ./applications/xonar-fp.nix { };
|
||||
}
|
||||
)
|
||||
];
|
||||
nixpkgs.config = {
|
||||
packageOverrides = pkgs: {
|
||||
i3lock-fancy = pkgs.callPackage ./applications/i3lock-fancy.nix {};
|
||||
git-with-libsecret = pkgs.git.override { withLibsecret = true; };
|
||||
};
|
||||
|
||||
nixpkgs.pkgs = import imports.nixpkgs {
|
||||
config.allowUnfree = true;
|
||||
} // config.nixpkgs.config;
|
||||
|
||||
nix = rec {
|
||||
useSandbox = true;
|
||||
autoOptimiseStore = config.deviceSpecific.isSSD;
|
||||
optimise.automatic = true;
|
||||
};
|
||||
}
|
@ -6,7 +6,7 @@ with deviceSpecific; {
|
||||
users.groups.smbgrp.gid = 2001;
|
||||
# TODO: add nologin shell to this user
|
||||
users.users.smbuser =
|
||||
lib.mkIf (isHost || config.device == "NixOS-VM") {
|
||||
lib.mkIf isHost {
|
||||
isNormalUser = false;
|
||||
extraGroups = [
|
||||
"smbgrp"
|
||||
@ -14,7 +14,7 @@ with deviceSpecific; {
|
||||
description = "User for samba sharing";
|
||||
};
|
||||
services.samba =
|
||||
lib.mkIf (isHost || config.device == "NixOS-VM") {
|
||||
lib.mkIf isHost {
|
||||
enable = true;
|
||||
enableNmbd = false;
|
||||
enableWinbindd = false;
|
||||
@ -50,7 +50,7 @@ with deviceSpecific; {
|
||||
'';
|
||||
};
|
||||
environment.systemPackages =
|
||||
if (isHost || config.device == "NixOS-VM") then
|
||||
if isHost then
|
||||
[ config.services.samba.package ]
|
||||
else
|
||||
[ ];
|
||||
|
@ -1,39 +1,42 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
device = config.devices.${config.device};
|
||||
in {
|
||||
|
||||
# services.acpid.enable = true;
|
||||
users.users.mopidy = {
|
||||
isNormalUser = false;
|
||||
extraGroups = [
|
||||
"smbgrp"
|
||||
];
|
||||
};
|
||||
services.mopidy = {
|
||||
enable = false;
|
||||
extensionPackages = with pkgs; [ mopidy-local-sqlite ];
|
||||
configuration = ''
|
||||
[local]
|
||||
enabled = true
|
||||
library = sqlite
|
||||
media_dir = /media/files/Music
|
||||
scan_timeout = 1000
|
||||
scan_flush_threshold = 100
|
||||
scan_follow_symlinks = false
|
||||
# users.users.mopidy = {
|
||||
# isNormalUser = false;
|
||||
# extraGroups = [
|
||||
# "smbgrp"
|
||||
# ];
|
||||
# };
|
||||
# services.mopidy = {
|
||||
# enable = true;
|
||||
# extensionPackages = with pkgs; [ mopidy-local-sqlite ];
|
||||
# configuration = ''
|
||||
# [local]
|
||||
# enabled = true
|
||||
# library = sqlite
|
||||
# media_dir = /media/files/Music
|
||||
# scan_timeout = 1000
|
||||
# scan_flush_threshold = 100
|
||||
# scan_follow_symlinks = false
|
||||
|
||||
[local-sqlite]
|
||||
enabled = true
|
||||
# [local-sqlite]
|
||||
# enabled = true
|
||||
|
||||
[audio]
|
||||
output = pulsesink server=127.0.0.1
|
||||
# [audio]
|
||||
# output = pulsesink server=127.0.0.1
|
||||
|
||||
[mpd]
|
||||
hostname = 0.0.0.0
|
||||
'';
|
||||
};
|
||||
home-manager.users.alukard.home.file.".ncmpcpp/config".text = ''
|
||||
mpd_host = 127.0.0.1
|
||||
mpd_port = 6600
|
||||
mpd_music_dir = "/media/files/Music"
|
||||
'';
|
||||
# [mpd]
|
||||
# hostname = 0.0.0.0
|
||||
# '';
|
||||
# };
|
||||
# home-manager.users.alukard.home.file.".ncmpcpp/config".text = ''
|
||||
# mpd_host = 127.0.0.1
|
||||
# mpd_port = 6600
|
||||
# mpd_music_dir = "/media/files/Music"
|
||||
# '';
|
||||
|
||||
# services.mopidy = {
|
||||
# enable = true;
|
||||
@ -58,7 +61,7 @@
|
||||
};
|
||||
|
||||
services.earlyoom = {
|
||||
enable = config.devices.${config.device}.ram < 12;
|
||||
enable = device.ram < 12;
|
||||
freeMemThreshold = 5;
|
||||
freeSwapThreshold = 100;
|
||||
};
|
||||
@ -72,12 +75,16 @@
|
||||
|
||||
services.accounts-daemon.enable = true;
|
||||
|
||||
services.avahi.enable = true;
|
||||
# services.avahi.ipv6 = true;
|
||||
services.avahi.nssmdns = true;
|
||||
services.avahi.publish.enable = true;
|
||||
services.avahi.publish.addresses = true;
|
||||
services.avahi.publish.domain = true;
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
# ipv6 = true;
|
||||
nssmdns = true;
|
||||
publish = {
|
||||
enable = true;
|
||||
addresses = true;
|
||||
domain = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.systemd-udev-settle.enable = false;
|
||||
|
||||
@ -85,10 +92,8 @@
|
||||
|
||||
services.gnome3.gnome-keyring.enable = true;
|
||||
|
||||
# TODO: move environment.systemPackages to applications/package.nix
|
||||
virtualisation.docker.enable = config.devices.${config.device}.enableDocker;
|
||||
environment.systemPackages = lib.mkIf (config.devices.${config.device}.enableDocker)
|
||||
[ pkgs.docker-compose ];
|
||||
virtualisation.docker.enable = device.enableDocker;
|
||||
|
||||
# virtualisation.virtualbox.host = lib.mkIf config.deviceSpecific.isHost {
|
||||
# enable = true;
|
||||
# # enableHardening = false;
|
||||
@ -96,11 +101,11 @@
|
||||
# };
|
||||
|
||||
# Install cdemu for some gaming purposes
|
||||
programs.cdemu = {
|
||||
enable = true;
|
||||
image-analyzer = false;
|
||||
gui = false;
|
||||
group = "cdrom";
|
||||
};
|
||||
# programs.cdemu = {
|
||||
# enable = true;
|
||||
# image-analyzer = false;
|
||||
# gui = false;
|
||||
# group = "cdrom";
|
||||
# };
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,6 @@ in {
|
||||
};
|
||||
config = {
|
||||
themes.colors = fromBase16 (fromYAML (builtins.readFile
|
||||
../imports/github/michael-ball/base16-horizon-scheme/horizon-dark.yaml));
|
||||
"${pkgs.imports.base16-horizon-scheme}/horizon-dark.yaml"));
|
||||
};
|
||||
}
|
||||
|
@ -42,24 +42,5 @@ in {
|
||||
ip link delete wg0
|
||||
'';
|
||||
};
|
||||
|
||||
# systemd.services."iptables-docker" = lib.mkIf (config.virtualisation.docker.enable) {
|
||||
# description = "Configure iptables to work with docker";
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# path = [ pkgs.iptables pkgs.iproute pkgs.gnugrep pkgs.gnused ];
|
||||
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# };
|
||||
|
||||
# script = ''
|
||||
# iptables -A FORWARD -i docker0 -o $(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//") -j ACCEPT
|
||||
# iptables -A FORWARD -i $(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//") -o docker0 -j ACCEPT
|
||||
# '';
|
||||
# };
|
||||
|
||||
# virtualisation.docker.extraOptions = lib.mkIf (config.virtualisation.docker.enable)
|
||||
# "--iptables=false";
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{ pkgs, lib, config, ... }: {
|
||||
home-manager.users.alukard = {
|
||||
programs.autorandr.hooks.preswitch.compton = "systemctl --user stop compton";
|
||||
programs.autorandr.hooks.postswitch.compton = "systemctl --user start compton";
|
||||
services.compton = {
|
||||
enable = true;
|
||||
backend = "glx";
|
||||
noDNDShadow = false;
|
||||
shadow = true;
|
||||
shadowExclude = [ "!(I3_FLOATING_WINDOW@:c = 1)" ];
|
||||
vSync = "opengl-swc";
|
||||
};
|
||||
};
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{ pkgs, config, ... }: {
|
||||
home-manager.users.alukard.programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
}
|
@ -6,11 +6,10 @@
|
||||
roboto
|
||||
roboto-mono
|
||||
roboto-slab
|
||||
# nerdfonts
|
||||
fira-code
|
||||
noto-fonts
|
||||
noto-fonts-emoji
|
||||
hasklig
|
||||
# hasklig
|
||||
powerline-fonts
|
||||
material-icons
|
||||
];
|
||||
|
@ -30,13 +30,13 @@ in {
|
||||
nixpkgs.overlays = [(self: super: {
|
||||
generated-gtk-theme = self.stdenv.mkDerivation rec {
|
||||
name = "generated-gtk-theme";
|
||||
src = ../../imports/github/nana-4/materia-theme;
|
||||
src = pkgs.imports.materia-theme;
|
||||
buildInputs = with self; [ sassc bc which inkscape optipng ];
|
||||
installPhase = ''
|
||||
HOME=/build
|
||||
chmod 777 -R .
|
||||
mkdir -p $out/share/themes
|
||||
patchShebangs .
|
||||
mkdir -p $out/share/themes
|
||||
substituteInPlace change_color.sh --replace "\$HOME/.themes" "$out/share/themes"
|
||||
echo "Changing colours:"
|
||||
./change_color.sh -o Generated ${materia_colors}
|
||||
@ -64,4 +64,5 @@ in {
|
||||
};
|
||||
};
|
||||
environment.sessionVariables.GTK_THEME = "Generated";
|
||||
environment.sessionVariables.GDK_BACKEND = "x11";
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ in {
|
||||
command = ''
|
||||
echo '<span font="Material Icons 11">location_searching</span>' $(${pkgs.bc}/bin/bc <<< `free | tail -2 | head -1 | awk '{print "scale=2; "$7"/1048576"}'`)GiB
|
||||
'';
|
||||
# command = scripts.free;
|
||||
};
|
||||
n_df = {
|
||||
command = ''
|
||||
|
@ -1,18 +1,6 @@
|
||||
p: c:
|
||||
with p;
|
||||
builtins.mapAttrs (name: value:
|
||||
stdenv.mkDerivation {
|
||||
name = "free";
|
||||
src = value;
|
||||
unpackPhase = "true";
|
||||
buildInputs = [ghc];
|
||||
buildPhase = "ghc -o $out $src";
|
||||
installPhase = "true";
|
||||
}) {
|
||||
free = ./free.hs;
|
||||
temperature = ./temperature.hs;
|
||||
network = ./network.hs;
|
||||
} // builtins.mapAttrs (name: value:
|
||||
writeTextFile {
|
||||
inherit name;
|
||||
text = callPackage value {
|
||||
@ -31,6 +19,4 @@ writeTextFile {
|
||||
sound = ./sound.nix;
|
||||
music = ./music.nix;
|
||||
vpn-status = ./vpn-status.nix;
|
||||
#temperature = ./temperature.nix;
|
||||
#free = ./free.nix;
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
import System.Exit
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
freeMemory <- read
|
||||
<$> (!!1) <$> words
|
||||
<$> (!!2) <$> lines
|
||||
<$> readFile "/proc/meminfo"
|
||||
putStr $ (take 5 $ show $ freeMemory / 1048576) ++ "GiB"
|
||||
exitWith $ if freeMemory > 500000 then ExitSuccess else ExitFailure 33
|
@ -1,40 +0,0 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
|
||||
import Control.Concurrent (threadDelay)
|
||||
import Control.Monad (mapM)
|
||||
import System.Directory (listDirectory)
|
||||
|
||||
path :: String
|
||||
path = "/sys/class/net/"
|
||||
|
||||
data Statistics = Statistics !Float !Float
|
||||
|
||||
instance Semigroup Statistics where
|
||||
Statistics a b <> Statistics c d = Statistics (a + c) (b + d)
|
||||
|
||||
instance Monoid Statistics where
|
||||
mempty = Statistics 0 0
|
||||
|
||||
icon :: String -> String
|
||||
icon i = "<span font='Material Icons 11'>" ++ i ++ "</span>"
|
||||
|
||||
readInterface :: FilePath -> IO Statistics
|
||||
readInterface interface = do
|
||||
rx <- read <$> readFile (path ++ interface ++ "/statistics/rx_bytes")
|
||||
tx <- read <$> readFile (path ++ interface ++ "/statistics/tx_bytes")
|
||||
return $ Statistics rx tx
|
||||
|
||||
readInterfaces :: [FilePath] -> IO Statistics
|
||||
readInterfaces interfaces = mconcat <$> (mapM readInterface interfaces)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
interfaces <- listDirectory path
|
||||
Statistics rx tx <- readInterfaces interfaces
|
||||
threadDelay 1000000
|
||||
Statistics rx' tx' <- readInterfaces interfaces
|
||||
putStrLn
|
||||
$ (icon "\58052")
|
||||
++ show (round $(rx' - rx)/1000) ++ "kBps "
|
||||
++ (icon "\58054")
|
||||
++ show (round $(tx' - tx)/1000) ++ "kBps"
|
@ -1,47 +0,0 @@
|
||||
import System.Directory
|
||||
import System.FilePath
|
||||
import Control.Monad (forM)
|
||||
import System.Posix.Files
|
||||
import Data.List (isPrefixOf, isInfixOf)
|
||||
import System.Exit
|
||||
|
||||
|
||||
|
||||
-- | Traverse from 'top' directory and return all the files by
|
||||
-- filtering with 'include' predicate.
|
||||
traverseDir :: FilePath -> (FilePath -> Bool) -> IO [FilePath]
|
||||
traverseDir top include = do
|
||||
ds <- getDirectoryContents top
|
||||
paths <- forM (filter include ds) $ \d -> do
|
||||
let path = top </> d
|
||||
s <- getFileStatus path
|
||||
if isDirectory s
|
||||
then traverseDir path include
|
||||
else return [path]
|
||||
return $ concat paths
|
||||
|
||||
|
||||
|
||||
-- | Get temperatures from hardware sensors in </sys/class/hwmon>
|
||||
getTemps :: IO [Int]
|
||||
getTemps = do
|
||||
hwmons <- traverseDir "/sys/class/hwmon"
|
||||
(
|
||||
\name
|
||||
-> ("hwmon" `isPrefixOf` name)
|
||||
|| ("temp" `isInfixOf` name) && ("input" `isInfixOf` name)
|
||||
)
|
||||
fmap (round .(/1000) . read) <$> traverse (readFile) hwmons
|
||||
|
||||
-- | Get a symbol corresponding to the temperature
|
||||
getSymbol :: Integral n => n -> String
|
||||
getSymbol t
|
||||
| t < 50 = "\57868" --
|
||||
| t < 80 = "\57866" --
|
||||
| otherwise = "\57867" --
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
maxTemp <- maximum <$> getTemps
|
||||
putStrLn $ (getSymbol <> show) maxTemp <> "°"
|
||||
exitWith $ if maxTemp < 80 then ExitSuccess else ExitFailure 33
|
@ -1,6 +0,0 @@
|
||||
{ ... }:
|
||||
''
|
||||
temp=$((`cat /sys/class/thermal/thermal_zone*/temp | sort | tail -1`/1000))
|
||||
echo $temp °
|
||||
[[ $temp -gt 80 ]] && exit 33
|
||||
''
|
@ -1,5 +1,5 @@
|
||||
{ curl, ... }: ''
|
||||
API="$(${curl} https://am.i.mullvad.net/connected)"
|
||||
API="$(${curl}/bin/curl https://am.i.mullvad.net/connected)"
|
||||
if [[ $(echo "$API" | awk -F'[ ()]+' '{print $6}') = 'server' ]]; then
|
||||
echo $(echo "$API" | awk -F'[ ()]+' '{print $7}')
|
||||
else
|
||||
|
@ -9,10 +9,12 @@
|
||||
};
|
||||
|
||||
services.atd.enable = true;
|
||||
|
||||
home-manager.users.alukard = {
|
||||
xdg.enable = true;
|
||||
|
||||
services.udiskie.enable = true;
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.git-with-libsecret;
|
||||
@ -24,18 +26,22 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
news.display = "silent";
|
||||
# programs.command-not-found = {
|
||||
# enable = true;
|
||||
# dbPath = ../../imports/programs.sqlite;
|
||||
# };
|
||||
|
||||
home.keyboard = {
|
||||
options = [ "grp:win_space_toogle" ];
|
||||
layout = "us,ru";
|
||||
};
|
||||
|
||||
home.file.".icons/default" = {
|
||||
source = "${pkgs.bibata-cursors}/share/icons/Bibata_Oil";
|
||||
};
|
||||
|
||||
systemd.user.startServices = true;
|
||||
};
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ with deviceSpecific; {
|
||||
"bestvideo+bestaudio/best";
|
||||
};
|
||||
};
|
||||
# TODO: отвязать от /home/alukard
|
||||
home-manager.users.alukard.home.file.".config/youtube-dl/config" = {
|
||||
text = ''
|
||||
--cookie=/home/alukard/.config/yt-cookie
|
||||
|
@ -1,160 +0,0 @@
|
||||
# cfg = config.devices.${config.device}.enableDocker;
|
||||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.podman;
|
||||
|
||||
surroundEachWith = str: list:
|
||||
map (e: str + (toString e) + str) list;
|
||||
|
||||
registriesConf = let
|
||||
registryList = list:
|
||||
"registries = [" + (concatStringsSep ", " (surroundEachWith "'" list)) + "]";
|
||||
in concatStringsSep "\n" (mapAttrsToList (type: registries: ''
|
||||
[registries.${type}]
|
||||
${registryList registries}
|
||||
'') { inherit (cfg.registries) block insecure search; });
|
||||
|
||||
in {
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
programs.podman = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whenever to configure <command>podman</command> user-wide.";
|
||||
};
|
||||
|
||||
installSystemWide = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Install packages system-wide.";
|
||||
};
|
||||
|
||||
registries = {
|
||||
search = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "docker.io" "quay.io" ];
|
||||
description = ''
|
||||
List of repositories to search.
|
||||
'';
|
||||
};
|
||||
|
||||
insecure = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = ''
|
||||
List of insecure repositories.
|
||||
'';
|
||||
};
|
||||
|
||||
block = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = ''
|
||||
List of blocked repositories.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
policy = mkOption {
|
||||
default = {
|
||||
default = [ { type = "reject"; }];
|
||||
};
|
||||
type = types.attrs;
|
||||
example = literalExample ''
|
||||
{
|
||||
default = [ { type = "insecureAcceptAnything"; } ];
|
||||
transports = {
|
||||
docker-daemon = {
|
||||
"" = [ { type = "insecureAcceptAnything"; } ];
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Signature verification policy file
|
||||
</para>
|
||||
<para>
|
||||
The default will simply reject everything.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
home-manager.users.alukard.xdg.configFile = {
|
||||
"containers/libpod.conf".text = ''
|
||||
cgroup_manager = "systemd"
|
||||
cni_config_dir = "/etc/cni/net.d/"
|
||||
cni_default_network = "podman"
|
||||
cni_plugin_dir = ["${pkgs.cni-plugins}/bin/"]
|
||||
conmon_path = ["${pkgs.conmon}/bin/conmon"]
|
||||
image_default_transport = "docker://"
|
||||
runtime = "${pkgs.crun}/bin/crun"
|
||||
runtimes = ["${pkgs.crun}/bin/crun", "${pkgs.runc}/bin/runc"]
|
||||
# pause
|
||||
pause_image = "k8s.gcr.io/pause:3.1"
|
||||
pause_command = "/pause"
|
||||
'';
|
||||
"containers/registries.conf".text = registriesConf;
|
||||
"containers/policy.json".text = builtins.toJSON cfg.policy;
|
||||
};
|
||||
|
||||
environment.etc."cni/net.d/87-podman-bridge.conflist".text = (builtins.toJSON {
|
||||
cniVersion = "0.3.0";
|
||||
name = "podman";
|
||||
plugins = [
|
||||
{
|
||||
type = "bridge";
|
||||
bridge = "cni0";
|
||||
isGateway = true;
|
||||
ipMasq = true;
|
||||
ipam = {
|
||||
type = "host-local";
|
||||
subnet = "10.88.0.0/16";
|
||||
routes = [
|
||||
{ dst = "0.0.0.0/0"; }
|
||||
];
|
||||
};
|
||||
}
|
||||
{
|
||||
type = "portmap";
|
||||
capabilities = {
|
||||
portMappings = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
environment.systemPackages = mkIf cfg.installSystemWide
|
||||
(with pkgs; [
|
||||
buildah conmon crun fuse-overlayfs podman runc slirp4netns iptables podman-compose
|
||||
]);
|
||||
|
||||
home-manager.users.alukard.home.packages = mkIf (!cfg.installSystemWide)
|
||||
(with pkgs; [
|
||||
buildah conmon crun fuse-overlayfs podman runc slirp4netns iptables podman-compose
|
||||
]);
|
||||
|
||||
users.users.alukard = {
|
||||
subUidRanges = [{ startUid = 100000; count = 65536; }];
|
||||
subGidRanges = [{ startGid = 100000; count = 65536; }];
|
||||
};
|
||||
})
|
||||
({
|
||||
programs.podman = {
|
||||
# enable = config.devices.${config.device}.enableDocker;
|
||||
enable = false;
|
||||
policy = {
|
||||
default = [ { type = "insecureAcceptAnything"; }];
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
@ -1,146 +1,4 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
with import ../../support.nix { inherit lib config; }; {
|
||||
# home-manager.users.alukard.home.file.".config/rofi/custom.rasi".text = ''
|
||||
# * {
|
||||
# red: rgba ( ${thmDec.red}, 100 % );
|
||||
# blue: rgba ( ${thmDec.blue}, 100 % );
|
||||
# lightfg: rgba ( ${thmDec.cyan}, 100 % );
|
||||
# lightbg: rgba ( ${thmDec.dark}, 100 % );
|
||||
# foreground: rgba ( ${thmDec.purple}, 100 % );
|
||||
# background: rgba ( ${thmDec.bg}, 100 % );
|
||||
# background-color: rgba ( ${thmDec.bg}, 0 % );
|
||||
# separatorcolor: @foreground;
|
||||
# border-color: @foreground;
|
||||
# selected-normal-foreground: @background;
|
||||
# selected-normal-background: @blue;
|
||||
# selected-active-foreground: @lightbg;
|
||||
# selected-active-background: @lightfg;
|
||||
# selected-urgent-foreground: @background;
|
||||
# selected-urgent-background: @red;
|
||||
# normal-foreground: @foreground;
|
||||
# normal-background: @background;
|
||||
# active-foreground: @blue;
|
||||
# active-background: @background;
|
||||
# urgent-foreground: @red;
|
||||
# urgent-background: @background;
|
||||
# alternate-normal-foreground: @foreground;
|
||||
# alternate-normal-background: @lightbg;
|
||||
# alternate-active-foreground: @blue;
|
||||
# alternate-active-background: @lightbg;
|
||||
# alternate-urgent-foreground: @red;
|
||||
# alternate-urgent-background: @lightbg;
|
||||
# spacing: 2;
|
||||
# }
|
||||
# window {
|
||||
# background-color: @background;
|
||||
# border: 1;
|
||||
# padding: 5;
|
||||
# }
|
||||
# mainbox {
|
||||
# border: 0;
|
||||
# padding: 0;
|
||||
# }
|
||||
# message {
|
||||
# border: 1px dash 0px 0px ;
|
||||
# border-color: @separatorcolor;
|
||||
# padding: 1px ;
|
||||
# }
|
||||
# textbox {
|
||||
# text-color: @foreground;
|
||||
# }
|
||||
# listview {
|
||||
# fixed-height: 0;
|
||||
# border: 2px dash 0px 0px ;
|
||||
# border-color: @separatorcolor;
|
||||
# spacing: 2px ;
|
||||
# scrollbar: true;
|
||||
# padding: 2px 0px 0px ;
|
||||
# }
|
||||
# element {
|
||||
# border: 0;
|
||||
# padding: 1px ;
|
||||
# }
|
||||
# element normal.normal {
|
||||
# background-color: @normal-background;
|
||||
# text-color: @normal-foreground;
|
||||
# }
|
||||
# element normal.urgent {
|
||||
# background-color: @urgent-background;
|
||||
# text-color: @urgent-foreground;
|
||||
# }
|
||||
# element normal.active {
|
||||
# background-color: @active-background;
|
||||
# text-color: @active-foreground;
|
||||
# }
|
||||
# element selected.normal {
|
||||
# background-color: @selected-normal-background;
|
||||
# text-color: @selected-normal-foreground;
|
||||
# }
|
||||
# element selected.urgent {
|
||||
# background-color: @selected-urgent-background;
|
||||
# text-color: @selected-urgent-foreground;
|
||||
# }
|
||||
# element selected.active {
|
||||
# background-color: @selected-active-background;
|
||||
# text-color: @selected-active-foreground;
|
||||
# }
|
||||
# element alternate.normal {
|
||||
# background-color: @alternate-normal-background;
|
||||
# text-color: @alternate-normal-foreground;
|
||||
# }
|
||||
# element alternate.urgent {
|
||||
# background-color: @alternate-urgent-background;
|
||||
# text-color: @alternate-urgent-foreground;
|
||||
# }
|
||||
# element alternate.active {
|
||||
# background-color: @alternate-active-background;
|
||||
# text-color: @alternate-active-foreground;
|
||||
# }
|
||||
# scrollbar {
|
||||
# width: 4px ;
|
||||
# border: 0;
|
||||
# handle-color: @normal-foreground;
|
||||
# handle-width: 8px ;
|
||||
# padding: 0;
|
||||
# }
|
||||
# sidebar {
|
||||
# border: 2px dash 0px 0px ;
|
||||
# border-color: @separatorcolor;
|
||||
# }
|
||||
# button {
|
||||
# spacing: 0;
|
||||
# text-color: @normal-foreground;
|
||||
# }
|
||||
# button selected {
|
||||
# background-color: @selected-normal-background;
|
||||
# text-color: @selected-normal-foreground;
|
||||
# }
|
||||
# inputbar {
|
||||
# spacing: 0px;
|
||||
# text-color: @normal-foreground;
|
||||
# padding: 1px ;
|
||||
# children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
# }
|
||||
# case-indicator {
|
||||
# spacing: 0;
|
||||
# text-color: @normal-foreground;
|
||||
# }
|
||||
# entry {
|
||||
# spacing: 0;
|
||||
# text-color: @normal-foreground;
|
||||
# }
|
||||
# prompt {
|
||||
# spacing: 0;
|
||||
# text-color: @normal-foreground;
|
||||
# }
|
||||
# textbox-prompt-colon {
|
||||
# expand: false;
|
||||
# str: ":";
|
||||
# margin: 0px 0.3000em 0.0000em 0.0000em ;
|
||||
# text-color: inherit;
|
||||
# }
|
||||
# '';
|
||||
# TODO: отвязать от абсолютного пути (/home/user/...)
|
||||
{ pkgs, config, lib, ... }: {
|
||||
home-manager.users.alukard.programs.rofi = {
|
||||
enable = true;
|
||||
font = "Roboto Mono 14";
|
||||
|
@ -47,23 +47,6 @@
|
||||
"URxvt.keysym.Control-Right" = "\\033[1;5C";
|
||||
"URxvt.keysym.Control-Left" = "\\033[1;5D";
|
||||
|
||||
# "emacs.color0" = dark;
|
||||
# "emacs.color1" = red;
|
||||
# "emacs.color2" = green;
|
||||
# "emacs.color3" = yellow;
|
||||
# "emacs.color4" = gray;
|
||||
# "emacs.color5" = purple;
|
||||
# "emacs.color6" = cyan;
|
||||
# "emacs.color7" = gray;
|
||||
# "emacs.color8" = alt;
|
||||
# "emacs.color9" = green;
|
||||
# "emacs.color10" = green;
|
||||
# "emacs.color11" = yellow;
|
||||
# "emacs.color12" = green;
|
||||
# "emacs.color13" = purple;
|
||||
# "emacs.color14" = cyan;
|
||||
# "emacs.color15" = fg;
|
||||
|
||||
};
|
||||
home.activation.xrdb = {
|
||||
after = ["linkGeneration"];
|
||||
|
@ -15,30 +15,15 @@
|
||||
{
|
||||
name = "zsh-nix-shell";
|
||||
file = "nix-shell.plugin.zsh";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "chisui";
|
||||
repo = "zsh-nix-shell";
|
||||
rev = "b2609ca787803f523a18bb9f53277d0121e30389";
|
||||
sha256 = "01w59zzdj12p4ag9yla9ycxx58pg3rah2hnnf3sw4yk95w3hlzi6";
|
||||
};
|
||||
src = pkgs.imports.zsh-nix-shell;
|
||||
}
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "v0.4.0";
|
||||
sha256 = "0z6i9wjjklb4lvr7zjhbphibsyx51psv50gm07mbb0kj9058j6kc";
|
||||
};
|
||||
src = pkgs.imports.zsh-autosuggestions;
|
||||
}
|
||||
{
|
||||
name = "you-should-use";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "MichaelAquilina";
|
||||
repo = "zsh-you-should-use";
|
||||
rev = "2be37f376c13187c445ae9534550a8a5810d4361";
|
||||
sha256 = "0yhwn6av4q6hz9s34h4m3vdk64ly6s28xfd8ijgdbzic8qawj5p1";
|
||||
};
|
||||
src = pkgs.imports.zsh-you-should-use;
|
||||
}
|
||||
];
|
||||
shellAliases = {
|
||||
|
110
nix/sources.json
Normal file
110
nix/sources.json
Normal file
@ -0,0 +1,110 @@
|
||||
{
|
||||
"base16-horizon-scheme": {
|
||||
"branch": "master",
|
||||
"description": null,
|
||||
"homepage": null,
|
||||
"owner": "AlukardBF",
|
||||
"repo": "base16-horizon-scheme",
|
||||
"rev": "644d073863ba9f863eef3b88a8f8607d0ace0063",
|
||||
"sha256": "1c88z0zv5wwc5p6ddvqv9h6681cayvkj5qxyxsig47lndx5zvjq3",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/AlukardBF/base16-horizon-scheme/archive/644d073863ba9f863eef3b88a8f8607d0ace0063.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"home-manager": {
|
||||
"branch": "master",
|
||||
"description": "Manage a user environment using Nix",
|
||||
"homepage": "",
|
||||
"owner": "rycee",
|
||||
"repo": "home-manager",
|
||||
"rev": "6cc4fd6ede4909226cb81d3475834251ed1b7210",
|
||||
"sha256": "123wb940yw8k0qr3gmhdxi4ilzp9d2a7jsb6br6ybz7082dknlx8",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/rycee/home-manager/archive/6cc4fd6ede4909226cb81d3475834251ed1b7210.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"materia-theme": {
|
||||
"branch": "master",
|
||||
"description": "A Material Design theme for GNOME/GTK based desktop environments",
|
||||
"homepage": "",
|
||||
"owner": "nana-4",
|
||||
"repo": "materia-theme",
|
||||
"rev": "b1e4c563146ae34fff6a697393b6a1bc66b612f5",
|
||||
"sha256": "1w65v7jl8v5h41d27gj79rnkbn8rw0avrj4gi57l8lvlhpn9q6a2",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nana-4/materia-theme/archive/b1e4c563146ae34fff6a697393b6a1bc66b612f5.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"niv": {
|
||||
"branch": "master",
|
||||
"description": "Easy dependency management for Nix projects",
|
||||
"homepage": "https://github.com/nmattia/niv",
|
||||
"owner": "nmattia",
|
||||
"repo": "niv",
|
||||
"rev": "2ecfd86b631714b457e56d70dd83fa60435baeb6",
|
||||
"sha256": "01j6727cws8blg1npp54b4w6xa0gpgyzhyws2vqgp8clnlnmqqhi",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nmattia/niv/archive/2ecfd86b631714b457e56d70dd83fa60435baeb6.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"branch": "nixos-unstable",
|
||||
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
|
||||
"homepage": "https://github.com/NixOS/nixpkgs",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs-channels",
|
||||
"rev": "a21c2fa3ea2b88e698db6fc151d9c7259ae14d96",
|
||||
"sha256": "1z3kxlbz6bqx1dlagcazg04vhk67r8byihzf959c3m0laf2a1w7y",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs-channels/archive/a21c2fa3ea2b88e698db6fc151d9c7259ae14d96.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixpkgs-mozilla": {
|
||||
"branch": "master",
|
||||
"description": "mozilla related nixpkgs (extends nixos/nixpkgs repo)",
|
||||
"homepage": null,
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"rev": "5300241b41243cb8962fad284f0004afad187dad",
|
||||
"sha256": "1h3g3817anicwa9705npssvkwhi876zijyyvv4c86qiklrkn5j9w",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/mozilla/nixpkgs-mozilla/archive/5300241b41243cb8962fad284f0004afad187dad.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"zsh-autosuggestions": {
|
||||
"branch": "master",
|
||||
"description": "Fish-like autosuggestions for zsh",
|
||||
"homepage": null,
|
||||
"owner": "zsh-users",
|
||||
"repo": "zsh-autosuggestions",
|
||||
"rev": "ae315ded4dba10685dbbafbfa2ff3c1aefeb490d",
|
||||
"sha256": "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/zsh-users/zsh-autosuggestions/archive/ae315ded4dba10685dbbafbfa2ff3c1aefeb490d.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"zsh-nix-shell": {
|
||||
"branch": "master",
|
||||
"description": "zsh plugin that lets you use zsh in nix-shell shell.",
|
||||
"homepage": "",
|
||||
"owner": "chisui",
|
||||
"repo": "zsh-nix-shell",
|
||||
"rev": "a65382a353eaee5a98f068c330947c032a1263bb",
|
||||
"sha256": "0l41ac5b7p8yyjvpfp438kw7zl9dblrpd7icjg1v3ig3xy87zv0n",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/chisui/zsh-nix-shell/archive/a65382a353eaee5a98f068c330947c032a1263bb.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"zsh-you-should-use": {
|
||||
"branch": "master",
|
||||
"description": "📎 ZSH plugin that reminds you to use existing aliases for commands you just typed",
|
||||
"homepage": "",
|
||||
"owner": "MichaelAquilina",
|
||||
"repo": "zsh-you-should-use",
|
||||
"rev": "888da3af69162c927e0f933ab8dc12395a52ad67",
|
||||
"sha256": "1gcxm08ragwrh242ahlq3bpfg5yma2cshwdlj8nrwnd4qwrsflgq",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/MichaelAquilina/zsh-you-should-use/archive/888da3af69162c927e0f933ab8dc12395a52ad67.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
}
|
||||
}
|
134
nix/sources.nix
Normal file
134
nix/sources.nix
Normal file
@ -0,0 +1,134 @@
|
||||
# This file has been generated by Niv.
|
||||
|
||||
let
|
||||
|
||||
#
|
||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
||||
#
|
||||
|
||||
fetch_file = pkgs: spec:
|
||||
if spec.builtin or true then
|
||||
builtins_fetchurl { inherit (spec) url sha256; }
|
||||
else
|
||||
pkgs.fetchurl { inherit (spec) url sha256; };
|
||||
|
||||
fetch_tarball = pkgs: spec:
|
||||
if spec.builtin or true then
|
||||
builtins_fetchTarball { inherit (spec) url sha256; }
|
||||
else
|
||||
pkgs.fetchzip { inherit (spec) url sha256; };
|
||||
|
||||
fetch_git = spec:
|
||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
|
||||
|
||||
fetch_builtin-tarball = spec:
|
||||
builtins.trace
|
||||
''
|
||||
WARNING:
|
||||
The niv type "builtin-tarball" will soon be deprecated. You should
|
||||
instead use `builtin = true`.
|
||||
|
||||
$ niv modify <package> -a type=tarball -a builtin=true
|
||||
''
|
||||
builtins_fetchTarball { inherit (spec) url sha256; };
|
||||
|
||||
fetch_builtin-url = spec:
|
||||
builtins.trace
|
||||
''
|
||||
WARNING:
|
||||
The niv type "builtin-url" will soon be deprecated. You should
|
||||
instead use `builtin = true`.
|
||||
|
||||
$ niv modify <package> -a type=file -a builtin=true
|
||||
''
|
||||
(builtins_fetchurl { inherit (spec) url sha256; });
|
||||
|
||||
#
|
||||
# Various helpers
|
||||
#
|
||||
|
||||
# The set of packages used when specs are fetched using non-builtins.
|
||||
mkPkgs = sources:
|
||||
let
|
||||
sourcesNixpkgs =
|
||||
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
|
||||
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
||||
in
|
||||
if builtins.hasAttr "nixpkgs" sources
|
||||
then sourcesNixpkgs
|
||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
||||
import <nixpkgs> {}
|
||||
else
|
||||
abort
|
||||
''
|
||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
||||
add a package called "nixpkgs" to your sources.json.
|
||||
'';
|
||||
|
||||
# The actual fetching function.
|
||||
fetch = pkgs: name: spec:
|
||||
|
||||
if ! builtins.hasAttr "type" spec then
|
||||
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
||||
else if spec.type == "file" then fetch_file pkgs spec
|
||||
else if spec.type == "tarball" then fetch_tarball pkgs spec
|
||||
else if spec.type == "git" then fetch_git spec
|
||||
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
|
||||
else if spec.type == "builtin-url" then fetch_builtin-url spec
|
||||
else
|
||||
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
||||
|
||||
# Ports of functions for older nix versions
|
||||
|
||||
# a Nix version of mapAttrs if the built-in doesn't exist
|
||||
mapAttrs = builtins.mapAttrs or (
|
||||
f: set: with builtins;
|
||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
||||
);
|
||||
|
||||
# fetchTarball version that is compatible between all the versions of Nix
|
||||
builtins_fetchTarball = { url, sha256 }@attrs:
|
||||
let
|
||||
inherit (builtins) lessThan nixVersion fetchTarball;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchTarball { inherit url; }
|
||||
else
|
||||
fetchTarball attrs;
|
||||
|
||||
# fetchurl version that is compatible between all the versions of Nix
|
||||
builtins_fetchurl = { url, sha256 }@attrs:
|
||||
let
|
||||
inherit (builtins) lessThan nixVersion fetchurl;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchurl { inherit url; }
|
||||
else
|
||||
fetchurl attrs;
|
||||
|
||||
# Create the final "sources" from the config
|
||||
mkSources = config:
|
||||
mapAttrs (
|
||||
name: spec:
|
||||
if builtins.hasAttr "outPath" spec
|
||||
then abort
|
||||
"The values in sources.json should not have an 'outPath' attribute"
|
||||
else
|
||||
spec // { outPath = fetch config.pkgs name spec; }
|
||||
) config.sources;
|
||||
|
||||
# The "config" used by the fetchers
|
||||
mkConfig =
|
||||
{ sourcesFile ? ./sources.json
|
||||
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
|
||||
, pkgs ? mkPkgs sources
|
||||
}: rec {
|
||||
# The sources, i.e. the attribute set of spec name to spec
|
||||
inherit sources;
|
||||
|
||||
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
||||
inherit pkgs;
|
||||
};
|
||||
in
|
||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
Loading…
x
Reference in New Issue
Block a user