Reformat nix code, and add a few CLI utilities

This commit is contained in:
Konstantin Nazarov 2023-09-30 23:07:32 +01:00
parent f97fbed4fe
commit 8fd7e4c619
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22
4 changed files with 245 additions and 222 deletions

View file

@ -4,13 +4,9 @@
{ config, lib, nixpkgs, pkgs, home-manager, ... }: { config, lib, nixpkgs, pkgs, home-manager, ... }:
let let my_python = (pkgs.python3.withPackages (ps: with ps; [ git_plan ]));
my_python = (pkgs.python3.withPackages (ps: with ps; [ in {
git_plan])); imports = [
in
{
imports =
[
#./gnupg.nix #./gnupg.nix
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
@ -39,7 +35,7 @@ in
owner = config.users.users.knazarov.name; owner = config.users.users.knazarov.name;
group = config.users.users.knazarov.group; group = config.users.users.knazarov.group;
}; };
mullvad_account = {}; mullvad_account = { };
}; };
}; };
@ -76,7 +72,6 @@ in
package = lib.mkForce pkgs.gnome3.gvfs; package = lib.mkForce pkgs.gnome3.gvfs;
}; };
# Configure keymap in X11 # Configure keymap in X11
services.xserver = { services.xserver = {
layout = "us"; layout = "us";
@ -87,12 +82,8 @@ in
users.users.knazarov = { users.users.knazarov = {
isNormalUser = true; isNormalUser = true;
description = "Konstantin Nazarov"; description = "Konstantin Nazarov";
extraGroups = [ extraGroups = [ "networkmanager" "wheel" config.users.groups.keys.name ];
"networkmanager" packages = with pkgs; [ ];
"wheel"
config.users.groups.keys.name
];
packages = with pkgs; [];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGxebDydOcs7URJjXFHMU++ruaZOJpXbK4ixH19pWTsX7WtxxriZxD4+RQ3oyllGG/8sEFzEe0NoTHUPU6YrBpfwT/ekGDmCJHtvZ+rZs+cRQd6tObfAUip1B1Mcvhuaj0prnrbfohOuHpvQ/L8TogIKuHgczDmud4KGUu0mxCsUHbD5tlKpsgN+dJXkvjxsO7JhhF9JpFTrYAU0gTuBPTt3ynpnZKrE1NgnE0iy+CEr/v41dLqxw3fUjT3nOFUQ1l/VKTw5mLt5Iw7XmBLuFGLRAVrwzXxeBCfYqKGYgY4QV8HCcVpcqC8zWmRskiRetzQ/5HwRagm4yZr0I+LZ305nGB0cSJzLWXXOUF6SDg2cqAXFpF/o2LoFCmaV5h3jmCGOUrowF7oV4mYwBMWfabrbZx21z/R56GkAOOEKc2h+Qh5wIj4yayX081SkqJK3J9+3vGG4VvXnwGnPnWQFqrzeedyV74maffGBGFYm0UOcD+oG6EwM+7MEUBpJm9m4c= knazarov" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGxebDydOcs7URJjXFHMU++ruaZOJpXbK4ixH19pWTsX7WtxxriZxD4+RQ3oyllGG/8sEFzEe0NoTHUPU6YrBpfwT/ekGDmCJHtvZ+rZs+cRQd6tObfAUip1B1Mcvhuaj0prnrbfohOuHpvQ/L8TogIKuHgczDmud4KGUu0mxCsUHbD5tlKpsgN+dJXkvjxsO7JhhF9JpFTrYAU0gTuBPTt3ynpnZKrE1NgnE0iy+CEr/v41dLqxw3fUjT3nOFUQ1l/VKTw5mLt5Iw7XmBLuFGLRAVrwzXxeBCfYqKGYgY4QV8HCcVpcqC8zWmRskiRetzQ/5HwRagm4yZr0I+LZ305nGB0cSJzLWXXOUF6SDg2cqAXFpF/o2LoFCmaV5h3jmCGOUrowF7oV4mYwBMWfabrbZx21z/R56GkAOOEKc2h+Qh5wIj4yayX081SkqJK3J9+3vGG4VvXnwGnPnWQFqrzeedyV74maffGBGFYm0UOcD+oG6EwM+7MEUBpJm9m4c= knazarov"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHkDvP2BO1uV0AwEjABYFEiA2BbGo1IsSht4emYMRLgi root@mira" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHkDvP2BO1uV0AwEjABYFEiA2BbGo1IsSht4emYMRLgi root@mira"
@ -131,6 +122,7 @@ in
pciutils pciutils
slack slack
q-sh q-sh
notes-sh
transmission-gtk transmission-gtk
mpv mpv
imv imv
@ -161,14 +153,16 @@ in
xournalpp xournalpp
dnsutils dnsutils
graphviz graphviz
fzf
nixfmt
#network-manager-applet #network-manager-applet
(clang-tools.override { llvmPackages = llvmPackages_16; }) # mainly for clang-format (clang-tools.override {
llvmPackages = llvmPackages_16;
}) # mainly for clang-format
(emacsWithPackagesFromUsePackage { (emacsWithPackagesFromUsePackage {
config = ./emacs.el; config = ./emacs.el;
defaultInitFile = true; defaultInitFile = true;
package = emacs29-pgtk.overrideAttrs (old: { package = emacs29-pgtk.overrideAttrs (old: { withTreeSitter = true; });
withTreeSitter = true;
});
alwaysEnsure = true; alwaysEnsure = true;
extraEmacsPackages = epkgs: [ extraEmacsPackages = epkgs: [
pkgs.mu pkgs.mu
@ -179,11 +173,9 @@ in
my_python my_python
]; ];
services.mullvad-vpn = { services.mullvad-vpn = { enable = true; };
enable = true; systemd.services."mullvad-daemon".postStart =
}; let mullvad = config.services.mullvad-vpn.package;
systemd.services."mullvad-daemon".postStart = let
mullvad = config.services.mullvad-vpn.package;
in '' in ''
while ! ${mullvad}/bin/mullvad status >/dev/null; do sleep 1; done while ! ${mullvad}/bin/mullvad status >/dev/null; do sleep 1; done
${mullvad}/bin/mullvad account login `cat /var/run/secrets/mullvad_account` ${mullvad}/bin/mullvad account login `cat /var/run/secrets/mullvad_account`
@ -191,7 +183,6 @@ in
${mullvad}/bin/mullvad tunnel ipv6 set on ${mullvad}/bin/mullvad tunnel ipv6 set on
''; '';
services.fwupd.enable = true; services.fwupd.enable = true;
services.gnome.gnome-keyring.enable = true; services.gnome.gnome-keyring.enable = true;
@ -201,7 +192,8 @@ in
environment.sessionVariables.NIXOS_OZONE_WL = "1"; environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Set default browser to qutebrowser in electron apps # Set default browser to qutebrowser in electron apps
environment.sessionVariables.DEFAULT_BROWSER = "${pkgs.qutebrowser}/bin/qutebrowser"; environment.sessionVariables.DEFAULT_BROWSER =
"${pkgs.qutebrowser}/bin/qutebrowser";
# Set default browser to qutebrowser everywhere else # Set default browser to qutebrowser everywhere else
xdg.mime.defaultApplications = { xdg.mime.defaultApplications = {
@ -224,9 +216,6 @@ in
}; };
}; };
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
@ -344,20 +333,22 @@ in
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh = { services.openssh = {
enable = true; enable = true;
# settings = { # settings = {
# passwordAuthentication = false; # passwordAuthentication = false;
# kbdInteractiveAuthentication = false; # kbdInteractiveAuthentication = false;
# }; # };
}; };
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
# Syncthing # Syncthing
8384 22000 8384
22000
]; ];
networking.firewall.allowedUDPPorts = [ networking.firewall.allowedUDPPorts = [
# Syncthing # Syncthing
22000 21027 22000
21027
]; ];
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
@ -386,9 +377,8 @@ in
font-awesome # for waybar indicators font-awesome # for waybar indicators
]; ];
home-manager.users.knazarov = { home-manager.users.knazarov = {
/* The home.stateVersion option does not have a default and must be set */ # The home.stateVersion option does not have a default and must be set
home.stateVersion = "23.05"; home.stateVersion = "23.05";
programs.bash = { programs.bash = {
@ -404,31 +394,29 @@ in
gtk = { gtk = {
enable = true; enable = true;
gtk3.extraConfig = { gtk3.extraConfig = { gtk-enable-animations = "0"; };
gtk-enable-animations = "0"; gtk4.extraConfig = { gtk-enable-animations = "0"; };
};
gtk4.extraConfig = {
gtk-enable-animations = "0";
};
}; };
programs.direnv = { programs.direnv = {
enable = true; enable = true;
nix-direnv = { nix-direnv = { enable = true; };
enable = true;
};
}; };
programs.gpg = { programs.gpg = {
enable = true; enable = true;
package = pkgs.gnupg; package = pkgs.gnupg;
publicKeys = [ publicKeys = [
{source = ./gpg_public_key.asc; trust="ultimate"; } {
{source = ./pgp_keys/FB4809DC51A4F483.asc; trust= "ultimate"; } source = ./gpg_public_key.asc;
trust = "ultimate";
}
{
source = ./pgp_keys/FB4809DC51A4F483.asc;
trust = "ultimate";
}
]; ];
settings = { settings = { default-key = "0x0560020C9C577C1B"; };
default-key = "0x0560020C9C577C1B";
};
mutableKeys = false; mutableKeys = false;
mutableTrust = false; mutableTrust = false;
}; };
@ -448,7 +436,8 @@ in
accounts.email = { accounts.email = {
maildirBasePath = "${config.users.users.knazarov.home}/Maildir"; maildirBasePath = "${config.users.users.knazarov.home}/Maildir";
accounts = { accounts = {
personal = let account = "mail@knazarov.com"; in { personal = let account = "mail@knazarov.com";
in {
primary = true; primary = true;
flavor = "fastmail.com"; flavor = "fastmail.com";
address = account; address = account;
@ -471,14 +460,10 @@ in
}; };
}; };
programs.mu = { programs.mu = { enable = true; };
enable = true;
};
programs.msmtp.enable = true; programs.msmtp.enable = true;
programs.mbsync = { programs.mbsync = { enable = true; };
enable = true;
};
#services.easyeffects = { #services.easyeffects = {
# enable = true; # enable = true;
@ -487,14 +472,20 @@ in
services.swayidle = { services.swayidle = {
enable = true; enable = true;
timeouts = [ timeouts = [
{ timeout = 300; command = "${pkgs.swaylock}/bin/swaylock -f -c 000000";} {
{ timeout = 600; timeout = 300;
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\""; command = "${pkgs.swaylock}/bin/swaylock -f -c 000000";
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";} }
]; {
events = [ timeout = 600;
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; } command = ''${pkgs.sway}/bin/swaymsg "output * dpms off"'';
resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"'';
}
]; ];
events = [{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock -f -c 000000";
}];
}; };
wayland.windowManager.sway = { wayland.windowManager.sway = {
@ -503,22 +494,26 @@ in
config = rec { config = rec {
modifier = "Mod4"; modifier = "Mod4";
terminal = "foot"; terminal = "foot";
bars = [{ bars = [{ "command" = "waybar"; }];
"command" = "waybar";
}];
keybindings = pkgs.lib.mkOptionDefault { keybindings = pkgs.lib.mkOptionDefault {
"XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; "XF86AudioRaiseVolume" =
"XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" =
"exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioMicMute" = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle"; "XF86AudioMicMute" =
"exec pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessUp" = "exec brightnessctl s +5%"; "XF86MonBrightnessUp" = "exec brightnessctl s +5%";
"XF86MonBrightnessDown" = "exec brightnessctl s 5%-"; "XF86MonBrightnessDown" = "exec brightnessctl s 5%-";
"Mod4+Return" = "exec emacs --eval '(progn (setq confirm-kill-processes nil) (vterm))'"; "Mod4+Return" =
"Mod4+space" = "exec ${pkgs.foot}/bin/foot -T mylauncher -a mylauncher ${pkgs.q-sh}/bin/q"; "exec emacs --eval '(progn (setq confirm-kill-processes nil) (vterm))'";
"Mod4+p" = "exec '${pkgs.grim}/bin/grim -g \"$$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png'"; "Mod4+space" =
"exec ${pkgs.foot}/bin/foot -T mylauncher -a mylauncher ${pkgs.q-sh}/bin/q";
"Mod4+p" =
"exec '${pkgs.grim}/bin/grim -g \"$$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png'";
}; };
output = { output = {
"*" = { bg = "${./wallpaper.jpg} fill";}; "*" = { bg = "${./wallpaper.jpg} fill"; };
"Lenovo Group Limited LEN T32p-20 VNA4VRNY" = { scale = "1.5"; }; "Lenovo Group Limited LEN T32p-20 VNA4VRNY" = { scale = "1.5"; };
}; };
input = { input = {
@ -531,11 +526,13 @@ in
inner = 10; inner = 10;
outer = 5; outer = 5;
}; };
colors.unfocused = {border = "#dddddd"; colors.unfocused = {
border = "#dddddd";
background = "#dddddd"; background = "#dddddd";
text = "#888888"; text = "#888888";
indicator = "#888888"; indicator = "#888888";
childBorder = "#888888";}; childBorder = "#888888";
};
}; };
extraConfig = '' extraConfig = ''
for_window [title="mylauncher"] floating enable for_window [title="mylauncher"] floating enable
@ -547,36 +544,34 @@ in
programs.foot = { programs.foot = {
enable = true; enable = true;
settings = { settings = {
main = { main = { font = "monospace:size=10"; };
font="monospace:size=10";
};
colors = { colors = {
background="feffff"; background = "feffff";
foreground="333333"; foreground = "333333";
regular0="333333"; regular0 = "333333";
regular1="bd4436"; regular1 = "bd4436";
regular2="008700"; regular2 = "008700";
regular3="cdcc42"; regular3 = "cdcc42";
regular4="0017f5"; regular4 = "0017f5";
regular5="b92cc6"; regular5 = "b92cc6";
regular6="5bbdf9"; regular6 = "5bbdf9";
regular7="c7c7c7"; regular7 = "c7c7c7";
bright0="333333"; bright0 = "333333";
bright1="bd4436"; bright1 = "bd4436";
bright2="008700"; bright2 = "008700";
bright3="cdcc42"; bright3 = "cdcc42";
bright4="0017f5"; bright4 = "0017f5";
bright5="b92cc6"; bright5 = "b92cc6";
bright6="5bbdf9"; bright6 = "5bbdf9";
bright7="feffff"; bright7 = "feffff";
}; };
key-bindings = { key-bindings = {
clipboard-copy="Control+Insert"; clipboard-copy = "Control+Insert";
clipboard-paste="Shift+Insert"; clipboard-paste = "Shift+Insert";
primary-paste="Control+Shift+v"; primary-paste = "Control+Shift+v";
}; };
}; };
}; };
@ -601,9 +596,7 @@ in
config.set('content.register_protocol_handler', False, 'https://calendar.google.com?cid=%25s') config.set('content.register_protocol_handler', False, 'https://calendar.google.com?cid=%25s')
''; '';
keyBindings = { keyBindings = {
insert = { insert = { "<Shift+Ins>" = "insert-text -- {clipboard}"; };
"<Shift+Ins>" = "insert-text -- {clipboard}";
};
}; };
}; };
programs.waybar = { programs.waybar = {
@ -612,10 +605,9 @@ in
layer = "top"; layer = "top";
position = "top"; position = "top";
height = 24; height = 24;
modules-left = ["sway/workspaces" "sway/mode"]; modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = ["sway/window"]; modules-center = [ "sway/window" ];
modules-right = modules-right = [ "idle_inhibitor" "battery" "clock" "tray" ];
[ "idle_inhibitor" "battery" "clock" "tray" ];
clock.format = "{:%Y-%m-%d %H:%M}"; clock.format = "{:%Y-%m-%d %H:%M}";
battery = { battery = {
states = { states = {
@ -627,7 +619,7 @@ in
format-charging = "{capacity}% "; format-charging = "{capacity}% ";
format-plugged = "{capacity}% "; format-plugged = "{capacity}% ";
format-alt = "{time} {icon}"; format-alt = "{time} {icon}";
format-icons = ["" "" "" "" ""]; format-icons = [ "" "" "" "" "" ];
}; };
idle_inhibitor = { idle_inhibitor = {
format = "{icon}"; format = "{icon}";
@ -638,9 +630,7 @@ in
}; };
}]; }];
}; };
services.syncthing = { services.syncthing = { enable = true; };
enable = true;
};
home.pointerCursor = { home.pointerCursor = {
name = "Adwaita"; name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme; package = pkgs.gnome.adwaita-icon-theme;
@ -656,26 +646,22 @@ in
podman = { podman = {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;
defaultNetwork.settings = { defaultNetwork.settings = { dns_enabled = true; };
dns_enabled = true;
}; };
}; };
}; services.udev.packages = [ pkgs.android-udev-rules ];
services.udev.packages = [
pkgs.android-udev-rules
];
#udevadm info --query=all --name=/dev/sda1 | grep ID_SERIAL #udevadm info --query=all --name=/dev/sda1 | grep ID_SERIAL
services.udev.extraRules = services.udev.extraRules =
''ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", '' + ''ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", '' + ''
''ENV{ID_FS_USAGE}=="filesystem", ENV{ID_SERIAL_SHORT}=="Hidizs_AP80PRO", '' + ENV{ID_FS_USAGE}=="filesystem", ENV{ID_SERIAL_SHORT}=="Hidizs_AP80PRO", ''
''RUN{program}+="${pkgs.systemd}/bin/systemd-mount --owner knazarov '' + + ''RUN{program}+="${pkgs.systemd}/bin/systemd-mount --owner knazarov ''
''--no-block --automount=yes --collect $devnode /media"''; + ''--no-block --automount=yes --collect $devnode /media"'';
systemd.timers."git_plan" = { systemd.timers."git_plan" = {
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
OnBootSec="1h"; OnBootSec = "1h";
OnUnitActiveSec="1h"; OnUnitActiveSec = "1h";
Unit = "git_plan.service"; Unit = "git_plan.service";
}; };
}; };
@ -687,15 +673,15 @@ in
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = "knazarov"; User = "knazarov";
StateDirectory="git_plan"; StateDirectory = "git_plan";
Environment="PYTHONUNBUFFERED=1"; Environment = "PYTHONUNBUFFERED=1";
}; };
}; };
systemd.timers."git_plan_pr" = { systemd.timers."git_plan_pr" = {
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
OnCalendar= "Mon,Tue,Wed,Thu,Fri *-*-* 10:00:00"; OnCalendar = "Mon,Tue,Wed,Thu,Fri *-*-* 10:00:00";
Unit = "git_plan_pr.service"; Unit = "git_plan_pr.service";
}; };
}; };
@ -707,8 +693,8 @@ in
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = "knazarov"; User = "knazarov";
StateDirectory="git_plan"; StateDirectory = "git_plan";
Environment="PYTHONUNBUFFERED=1"; Environment = "PYTHONUNBUFFERED=1";
}; };
}; };
} }

View file

@ -290,6 +290,9 @@
(evil-define-key 'normal 'global (kbd "<leader>b") 'switch-to-buffer) (evil-define-key 'normal 'global (kbd "<leader>b") 'switch-to-buffer)
(evil-define-key 'normal 'global (kbd "<leader>r") 'consult-ripgrep) (evil-define-key 'normal 'global (kbd "<leader>r") 'consult-ripgrep)
;; Make :q close the current buffer, and not the whole emacs process
(global-set-key [remap evil-quit] 'kill-buffer-and-window)
;; -------- Tools and environment -------- ;; -------- Tools and environment --------
;; By default, Emacs doesn't add system path to its search places ;; By default, Emacs doesn't add system path to its search places

View file

@ -90,11 +90,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1695674553, "lastModified": 1695939862,
"narHash": "sha256-gl/4yEfN0nsAhY/gBRO/GmxbbJZMQHXERm7Jrr2lJug=", "narHash": "sha256-YKDlS3HCXiMflP5i/uEQnZf2henO10beetINHj80hmU=",
"owner": "~knazarov", "owner": "~knazarov",
"repo": "knazarov.com", "repo": "knazarov.com",
"rev": "b851bb106e03996a1c00212986217db464b90424", "rev": "ea70e4a202b4fdc0e5e20c5fce9a631093d3cf35",
"type": "sourcehut" "type": "sourcehut"
}, },
"original": { "original": {
@ -134,6 +134,26 @@
"type": "github" "type": "github"
} }
}, },
"notes-sh": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1696081283,
"narHash": "sha256-ldiJ3gWOvW/aq3zwetnSg1pjU7PfKYVsQWxIZGM/NNA=",
"owner": "~knazarov",
"repo": "notes.sh",
"rev": "38e2883be54cd6634d83888f8f8545ddb44b9556",
"type": "sourcehut"
},
"original": {
"owner": "~knazarov",
"repo": "notes.sh",
"type": "sourcehut"
}
},
"q-sh": { "q-sh": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -162,6 +182,7 @@
"knazarovcom": "knazarovcom", "knazarovcom": "knazarovcom",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"notes-sh": "notes-sh",
"q-sh": "q-sh", "q-sh": "q-sh",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"vmatveevacom": "vmatveevacom" "vmatveevacom": "vmatveevacom"

View file

@ -3,36 +3,40 @@
{ {
inputs = { inputs = {
nixpkgs.url = github:NixOS/nixpkgs; nixpkgs.url = "github:NixOS/nixpkgs";
nixpkgs-stable.url = github:NixOS/nixpkgs/nixos-23.05; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.05";
home-manager.url = github:nix-community/home-manager/release-23.05; home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.url = github:nix-community/emacs-overlay; emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs"; emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.inputs.nixpkgs-stable.follows = "nixpkgs-stable"; emacs-overlay.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
sops-nix.url = github:Mic92/sops-nix; sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs-stable"; sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
q-sh.url = sourcehut:~knazarov/q.sh; q-sh.url = "sourcehut:~knazarov/q.sh";
q-sh.inputs.nixpkgs.follows = "nixpkgs"; q-sh.inputs.nixpkgs.follows = "nixpkgs";
knazarovcom.url = sourcehut:~knazarov/knazarov.com; notes-sh.url = "sourcehut:~knazarov/notes.sh";
notes-sh.inputs.nixpkgs.follows = "nixpkgs";
knazarovcom.url = "sourcehut:~knazarov/knazarov.com";
knazarovcom.inputs.nixpkgs.follows = "nixpkgs"; knazarovcom.inputs.nixpkgs.follows = "nixpkgs";
vmatveevacom.url = github:valeriya-matveeva/vmatveeva.com; vmatveevacom.url = "github:valeriya-matveeva/vmatveeva.com";
vmatveevacom.inputs.nixpkgs.follows = "nixpkgs"; vmatveevacom.inputs.nixpkgs.follows = "nixpkgs";
git-plan.url = sourcehut:~knazarov/git-plan; git-plan.url = "sourcehut:~knazarov/git-plan";
git-plan.inputs.nixpkgs.follows = "nixpkgs"; git-plan.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, emacs-overlay, sops-nix, q-sh, knazarovcom, vmatveevacom, git-plan, ... }@attrs: outputs = { self, nixpkgs, nixpkgs-stable, home-manager, emacs-overlay
, sops-nix, q-sh, notes-sh, knazarovcom, vmatveevacom, git-plan, ...
}@attrs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { specialArgs = { inherit attrs; };
inherit attrs;
};
buildConfig = modules: system: { inherit modules system specialArgs; }; buildConfig = modules: system: { inherit modules system specialArgs; };
buildSystem = modules: system: nixpkgs.lib.nixosSystem (buildConfig modules system); buildSystem = modules: system:
buildSystemStable = modules: system: nixpkgs-stable.lib.nixosSystem (buildConfig modules system); nixpkgs.lib.nixosSystem (buildConfig modules system);
buildSystemStable = modules: system:
nixpkgs-stable.lib.nixosSystem (buildConfig modules system);
hostAttrs = dir: { hostAttrs = dir: {
settings = import "${dir}/host-metadata.nix"; settings = import "${dir}/host-metadata.nix";
@ -40,33 +44,42 @@
hw-config = import "${dir}/hardware-configuration.nix"; hw-config = import "${dir}/hardware-configuration.nix";
}; };
node = dir: with hostAttrs dir; buildSystemStable [ node = dir:
({ config, pkgs, ... }: { nixpkgs.overlays = [ emacs-overlay.overlay q-sh.overlays.default with hostAttrs dir;
buildSystemStable [
({ config, pkgs, ... }: {
nixpkgs.overlays = [
emacs-overlay.overlay
q-sh.overlays.default
notes-sh.overlays.default
git-plan.overlays.default git-plan.overlays.default
]; }) ];
})
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
home-manager.nixosModule home-manager.nixosModule
config config
hw-config hw-config
./configuration.nix ./configuration.nix
] ] settings.system;
settings.system;
server = dir: with hostAttrs dir; buildSystem [ server = dir:
({ config, pkgs, ... }: { nixpkgs.overlays = [ with hostAttrs dir;
buildSystem [
({ config, pkgs, ... }: {
nixpkgs.overlays = [
emacs-overlay.overlay emacs-overlay.overlay
q-sh.overlays.default q-sh.overlays.default
knazarovcom.overlays.default knazarovcom.overlays.default
vmatveevacom.overlays.default]; }) vmatveevacom.overlays.default
];
})
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
home-manager.nixosModule home-manager.nixosModule
config config
hw-config hw-config
#(dir + "/configuration.nix") #(dir + "/configuration.nix")
] ] settings.system;
settings.system; in {
in
{
nixosConfigurations = { nixosConfigurations = {
mira = node ./nodes/mira; mira = node ./nodes/mira;
framework = node ./nodes/framework; framework = node ./nodes/framework;