diff options
-rw-r--r-- | configurations/manwe/default.nix | 8 | ||||
-rw-r--r-- | configurations/varda/default.nix | 9 | ||||
-rw-r--r-- | flake.lock | 89 | ||||
-rw-r--r-- | flake.nix | 13 | ||||
-rw-r--r-- | modules/nixfiles/common/nix/default.nix | 5 | ||||
-rw-r--r-- | modules/nixfiles/emacs/default.nix | 12 | ||||
-rw-r--r-- | modules/nixfiles/emacs/doom/config.el | 35 | ||||
-rw-r--r-- | modules/nixfiles/emacs/doom/custom.el | 0 | ||||
-rw-r--r-- | modules/nixfiles/emacs/doom/init.el | 30 | ||||
-rw-r--r-- | modules/nixfiles/emacs/doom/packages.el | 10 | ||||
-rw-r--r-- | modules/nixfiles/endlessh-go.nix | 51 | ||||
-rw-r--r-- | modules/nixfiles/profiles/headless.nix | 2 | ||||
-rw-r--r-- | modules/nixfiles/x11.nix | 31 | ||||
-rw-r--r-- | packages/bruh.nix | 6 | ||||
-rw-r--r-- | packages/nixfiles.nix | 25 |
15 files changed, 172 insertions, 154 deletions
diff --git a/configurations/manwe/default.nix b/configurations/manwe/default.nix index bb54c1b..4f6b8ef 100644 --- a/configurations/manwe/default.nix +++ b/configurations/manwe/default.nix @@ -52,10 +52,10 @@ with lib; { job_name = "endlessh-go"; static_configs = [ { - targets = with config.nixfiles.modules.endlessh-go; [ - "${manwe.hostname}:${toString prometheusPort}" - "${varda.hostname}:${toString prometheusPort}" - "${yavanna.hostname}:${toString prometheusPort}" + targets = with config.services.endlessh-go.prometheus; [ + "${manwe.hostname}:${toString port}" + "${varda.hostname}:${toString port}" + "${yavanna.hostname}:${toString port}" ]; } ]; diff --git a/configurations/varda/default.nix b/configurations/varda/default.nix index d7c6132..524842e 100644 --- a/configurations/varda/default.nix +++ b/configurations/varda/default.nix @@ -22,8 +22,6 @@ with lib; { acme.enable = true; }; - # systemd.services.minecraft-server.wantedBy = mkForce []; - networking = let interface = "eth0"; in { @@ -80,5 +78,12 @@ with lib; { }; }; + swapDevices = [ + { + device = "/swapfile"; + size = 4 * 1024; + } + ]; + system.stateVersion = "22.05"; } diff --git a/flake.lock b/flake.lock index bc40af0..98e42ce 100644 --- a/flake.lock +++ b/flake.lock @@ -81,11 +81,11 @@ "doom-emacs": { "flake": false, "locked": { - "lastModified": 1660835296, - "narHash": "sha256-dEg/Ck0S6HZUO3VAVvd5oWyxitaKy7+DLljNq3Slpr0=", + "lastModified": 1660901074, + "narHash": "sha256-3apl0eQlfBj3y0gDdoPp2M6PXYnhxs0QWOHp8B8A9sc=", "owner": "doomemacs", "repo": "doomemacs", - "rev": "4c9df9bfc63d2c3a9e20e20deaa854072e379f47", + "rev": "c44bc81a05f3758ceaa28921dd9c830b9c571e61", "type": "github" }, "original": { @@ -121,11 +121,11 @@ ] }, "locked": { - "lastModified": 1661315932, - "narHash": "sha256-3+CUK8wx+oEaKhrXWrK9LQVdhtkArXcy+mvihstlAXc=", + "lastModified": 1661598612, + "narHash": "sha256-0W31cSC+ggoP8kxN0Hn8HWd0wK37hLx4ul7IO4gKztE=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "9df7898566fe546ddebc15e665a938a9dec84d01", + "rev": "d8891991eef88a53a979ff242663429cef82a094", "type": "github" }, "original": { @@ -328,11 +328,11 @@ ] }, "locked": { - "lastModified": 1661323822, - "narHash": "sha256-1UGGcQ00uSo5cPTwL7C3S1zkcScbpF0WzspvnceWkbQ=", + "lastModified": 1661573386, + "narHash": "sha256-pBEg8iY00Af/SAtU2dlmOAv+2x7kScaGlFRDjNoVJO8=", "owner": "nix-community", "repo": "home-manager", - "rev": "1d81e6295ca530603478114f4977402d51299ad8", + "rev": "d89bdff445eadff03fe414e9c30486bc8166b72b", "type": "github" }, "original": { @@ -377,11 +377,11 @@ "ws-butler": "ws-butler" }, "locked": { - "lastModified": 1660946298, - "narHash": "sha256-XzIcFkcTsScS7blStWdPNXJ74FYPRbgTc30NvKeFzu8=", + "lastModified": 1661480711, + "narHash": "sha256-gwvvwppGDBFYXfuchpvRRHiKBM8XCE1ZnpldryKPN9o=", "owner": "nix-community", "repo": "nix-doom-emacs", - "rev": "b62e04967ad303f0395025d5f2340beef8a67a57", + "rev": "ae22b4a3fe31ae31b3e8b415889f8c2c5a77d8dc", "type": "github" }, "original": { @@ -401,11 +401,11 @@ ] }, "locked": { - "lastModified": 1661219530, - "narHash": "sha256-jLKEpwbkp3ryXho5RT5hjhLjBOZelGm6X5JWUUxuwsA=", + "lastModified": 1661565271, + "narHash": "sha256-GTa5fSSifG57cDaklJfVj4MpWl/1vqiSPu4My2wLkVc=", "owner": "jyooru", "repo": "nix-minecraft-servers", - "rev": "e624f6c056d95df8d6335d12bed0fe3c5af05159", + "rev": "4724b9ab810125bc71dbbeca22237532cb61831b", "type": "github" }, "original": { @@ -449,11 +449,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1661239106, - "narHash": "sha256-C5OCLnrv2c4CHs9DMEtYKkjJmGL7ySAZ1PqPkHBonxQ=", + "lastModified": 1661336769, + "narHash": "sha256-5Sf9tMd1Jdm+lTBGspbQ4kEoYCDKpUhEVAZHRcm6mGU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "963d27a0767422be9b8686a8493dcade6acee992", + "rev": "03428dbaaa23d6bf458770907b0927b377c873a8", "type": "github" }, "original": { @@ -463,13 +463,29 @@ "type": "github" } }, + "nixpkgs-endlessh-go": { + "locked": { + "lastModified": 1661682252, + "narHash": "sha256-Hj1leGuWEWmf4Oq9XUUDJ8R/YijhHlnd9P/C4v7UwmA=", + "owner": "azahi", + "repo": "nixpkgs", + "rev": "3242f1f7dd92e1fd517909c0cb0b0fce4e43f02a", + "type": "github" + }, + "original": { + "owner": "azahi", + "ref": "endlessh-go", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-master": { "locked": { - "lastModified": 1661326595, - "narHash": "sha256-efDmckd14Muk9GBGUx4gMVBNI0tjt1UO0VOf+7TE5No=", + "lastModified": 1661601515, + "narHash": "sha256-aUM6fegqcyzm0meFaQBoZQ1WXNENwUP3AVZ8fXtTG68=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b9f400f2989c97cb4016c7035b4dc0b4fe118060", + "rev": "bc755f55d70562770d9bb7675e42c68f5c7ac8de", "type": "github" }, "original": { @@ -481,11 +497,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1661309001, - "narHash": "sha256-a0CDFy+TD1/csQw+Bqdk4cT//BVAvp+A4QPYbUV9LlQ=", + "lastModified": 1661573771, + "narHash": "sha256-IBa1HhJ4V8ee48Nax19g61Fj6JYkp9AnIifNdbao1io=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a5c89f496b91b441f5259c29bd48b62e0d265b25", + "rev": "6cb1065d6e1016f849aac902206527a969ba62b3", "type": "github" }, "original": { @@ -547,11 +563,11 @@ }, "nur": { "locked": { - "lastModified": 1661324410, - "narHash": "sha256-UDZxQoSt5YqydpSbaqS3XQBura9Z4beJZo7mnBT1zp4=", + "lastModified": 1661598986, + "narHash": "sha256-kHg67hWaNtkjAI1Lx1fPbnmF5nhf3CjRJLCem9qM/p0=", "owner": "nix-community", "repo": "NUR", - "rev": "67fc62908c93529adb71baadc9d120e5a0106711", + "rev": "97e379f7286d90cd5086827d1250ad7ca7a3878b", "type": "github" }, "original": { @@ -580,11 +596,11 @@ "org": { "flake": false, "locked": { - "lastModified": 1660824704, - "narHash": "sha256-rEjxbktmMt1dFlF7Dd6+bo0oAYCOP/ylfcRDeCCgb58=", + "lastModified": 1661237582, + "narHash": "sha256-pebP1mA019FejUe6CURqDUaqPyTUZ3wRcqfd6gE+YVg=", "owner": "emacs-straight", "repo": "org-mode", - "rev": "f28288c255e293591725cbcd02637707bc9a77c2", + "rev": "3c11e9df6e8353ae5d7e1179f9bcb114f469c942", "type": "github" }, "original": { @@ -596,11 +612,11 @@ "org-contrib": { "flake": false, "locked": { - "lastModified": 1659039737, - "narHash": "sha256-ig8pVl790DopN6ZrCTIrvojt5/0Y+aOsjE87pqIVz8M=", + "lastModified": 1661026052, + "narHash": "sha256-rE7aioQxeVjo+TVI4DIppKkmf/c7tRNzK6hQJAmUnVE=", "owner": "emacsmirror", "repo": "org-contrib", - "rev": "39e2abc5629c1be6186bb6489ec4f76524edf82a", + "rev": "0740bd3fe69c4b327420185d931dcf0a9900a80e", "type": "github" }, "original": { @@ -695,6 +711,7 @@ "nix-minecraft-servers": "nix-minecraft-servers", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", + "nixpkgs-endlessh-go": "nixpkgs-endlessh-go", "nixpkgs-master": "nixpkgs-master", "nixpkgs-stable": "nixpkgs-stable", "nmap-vulners": "nmap-vulners", @@ -768,11 +785,11 @@ "ts-fold": { "flake": false, "locked": { - "lastModified": 1660200855, - "narHash": "sha256-y2gouqMbu619qPy48HjAuURLReH96zEKdhvmyIoEZuM=", + "lastModified": 1661407110, + "narHash": "sha256-tJfJFYeANRGu3ObQHGTxhXqS++JVVQREh8RTMwwbwYQ=", "owner": "jcs-elpa", "repo": "ts-fold", - "rev": "f0804a243544fbbf593791e4390d838b5d1187b0", + "rev": "3b2e70db92f127dc2e8e302e009447c1a9eb49aa", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d042cff..cfd62b6 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,14 @@ # path = "/home/azahi/src/nixpkgs"; # }; + # FIXME https://github.com/NixOS/nixpkgs/pull/187026 + nixpkgs-endlessh-go = { + type = "github"; + owner = "azahi"; + repo = "nixpkgs"; + ref = "endlessh-go"; + }; + nixos-hardware = { type = "github"; owner = "NixOS"; @@ -222,9 +230,7 @@ overlays = [self.overlays.default]; }; in { - packages.default = pkgs.nixfiles.override { - nixfilesSrc = "."; - }; + packages.default = pkgs.nixfiles; apps.${system}.default = { type = "app"; @@ -260,7 +266,6 @@ nixosConfigurations = import ./configurations {inherit inputs lib;}; - # TODO Generalise this. overlays.default = final: _: { UltimMC = final.libsForQt5.callPackage ./packages/ultimmc.nix {}; bruh = final.callPackage ./packages/bruh.nix {}; diff --git a/modules/nixfiles/common/nix/default.nix b/modules/nixfiles/common/nix/default.nix index 4e995d3..3d320ae 100644 --- a/modules/nixfiles/common/nix/default.nix +++ b/modules/nixfiles/common/nix/default.nix @@ -87,11 +87,6 @@ with lib; { alejandra = super.alejandra.overrideAttrs (_: _: { patches = [./patches/alejandra-no-ads.patch]; }); - - # FIXME https://github.com/NixOS/nixpkgs/pull/187519 - dendrite = super.dendrite.overrideAttrs (_: _: { - doCheck = false; - }); } // (with super; let np = nodePackages; diff --git a/modules/nixfiles/emacs/default.nix b/modules/nixfiles/emacs/default.nix index 86db0f7..41b2085 100644 --- a/modules/nixfiles/emacs/default.nix +++ b/modules/nixfiles/emacs/default.nix @@ -48,9 +48,9 @@ in { cmigemo # :lang japanese dockerfile-language-server # :tools (docker +lsp) editorconfig # :tools editorconfig - fd # core + fd # doom! gnuplot # :lang (org +gnuplot) - gnutls # core + gnutls # doom! gomodifytags # :lang go gopls # :lang (go +lsp) gore # :lang go @@ -72,19 +72,25 @@ in { nodePackages.prettier # :editor format nodePackages.stylelint # :lang web pandoc # :lang org markdown latex + pinentry-emacs # doom! pre-commit # :tools magit python3Packages.black # :lang python :editor format python3Packages.isort # :lang python python3Packages.pyflakes # :lang python - ripgrep # core + ripgrep # doom! rust-analyzer # :lang rust shellcheck # :lang sh shfmt # :lang sh :editor format sqlite # :lang (org +roam2) :tools lookup texlive.combined.scheme-full # :lang org tex wordnet # :tools (lookup +dictionary +offline) + xclip # :app everywhere + xdotool # :app everywhere + xorg.xprop # :app everywhere + xorg.xwininfo # :app everywhere yaml-language-server # :lang (yaml +lsp) zls # :lang (zig +lsp) + zstd # :emacs undo ]; in '' ;; This will integrate packages, which are required by various modules diff --git a/modules/nixfiles/emacs/doom/config.el b/modules/nixfiles/emacs/doom/config.el index ac9cdb3..bd429c0 100644 --- a/modules/nixfiles/emacs/doom/config.el +++ b/modules/nixfiles/emacs/doom/config.el @@ -1,15 +1,29 @@ ;;; config.el -*- lexical-binding: t; -*- -(setq doom-theme 'doom-tomorrow-night) - (setq frame-title-format '("Emacs") icon-title-format frame-title-format) +(setq doom-theme 'doom-tomorrow-night) + (setq org-directory "~/doc/org/" org-roam-directory "~/doc/roam/" - org-roam-db-location (concat org-roam-directory ".db")) -(setq deft-directory org-directory - deft-default-extension "org") + org-roam-db-location (concat org-roam-directory ".db") + org-todo-keywords '((sequence + "PROJ(p)" ; A master task. + "TODO(t)" ; A task that needs to be done with statues: + "STRT(s@)" ; - In progress. + "HOLD(l@/!)" ; - Paused because of me. + "WAIT(w@/!)" ; - Paused because of not me. + "|" + "DONE(d@/!)" ; Complete state. + "KILL(k@/!)")) ; Incomplete state. + org-todo-keyword-faces '(("PROJ" . +org-todo-project) + ("TODO" . +org-todo-active) + ("STRT" . +org-todo-active) + ("HOLD" . +org-todo-onhold) + ("WAIT" . +org-todo-onhold) + ("DONE" . +org-todo-cancel) + ("KILL" . +org-todo-cancel))) (use-package! websocket :after org-roam) @@ -22,8 +36,13 @@ org-roam-ui-update-on-save t org-roam-ui-open-on-start t)) +(setq deft-directory org-directory + deft-default-extension "org") + (setq lsp-haskell-formatting-provider "brittany") +(setq editorconfig-exclude-modes '(elisp-mode)) + (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)) (after! lsp-mode @@ -36,8 +55,7 @@ (setq-hook! 'yaml-mode-hook +format-with-lsp nil) -(setq +format-on-save-enabled-modes - '(not yaml-mode nix-mode)) +(setq +format-on-save-enabled-modes '(not yaml-mode nix-mode)) (add-hook 'org-mode-hook (lambda (&rest _) @@ -60,6 +78,8 @@ (setq display-line-numbers-type t) +(setq highlight-indent-guides-method 'fill) + (setq browse-url-generic-program (executable-find "firefox") browse-url-browser-function 'browse-url-generic) @@ -78,7 +98,6 @@ "a.gondor@yahoo.com" "a.gondor@yahoo.com")) - (set-email-account! "yahoo" '( (mu4e-sent-folder . "/yahoo/Sent") diff --git a/modules/nixfiles/emacs/doom/custom.el b/modules/nixfiles/emacs/doom/custom.el deleted file mode 100644 index e69de29..0000000 --- a/modules/nixfiles/emacs/doom/custom.el +++ /dev/null diff --git a/modules/nixfiles/emacs/doom/init.el b/modules/nixfiles/emacs/doom/init.el index 4f2fd4e..9ad69c6 100644 --- a/modules/nixfiles/emacs/doom/init.el +++ b/modules/nixfiles/emacs/doom/init.el @@ -13,14 +13,14 @@ ;; doom-dashboard ;; doom-quit hl-todo - indent-guides + ;; indent-guides ;; ligatures ;; modeline - nav-flash + ;; nav-flash ophints (popup +defaults) ;; tabs - (treemacs +lsp) + ;; (treemacs +lsp) ;; unicode (vc-gutter +diff-hl +pretty) window-select @@ -55,7 +55,7 @@ (spell +aspell +everywhere +flyspell) - grammar + ;; grammar :tools ansible @@ -71,7 +71,6 @@ (pass +auth) pdf terraform - ;; tmux tree-sitter upload @@ -82,38 +81,35 @@ (cc +lsp +tree-sitter) common-lisp ;; (csharp +lsp +tree-sitter) - ;; data + data dhall emacs-lisp (go +lsp +tree-sitter) - ;; (graphql +lsp) + ;; graphql (haskell +lsp) (java +lsp +tree-sitter) (javascript +lsp +tree-sitter) - json + (json +tree-sitter) (latex +lsp +tree-sitter) (lua +lsp +tree-sitter) markdown (nix +lsp +tree-sitter) - (org +brain - +gnuplot - +hugo + (org +hugo +journal +noter +pandoc +pomodoro +present - +pretty +roam2) plantuml (python +lsp +tree-sitter) - (racket +lsp +tree-sitter) - rst + ;; (racket +lsp +tree-sitter) + ;; rst (rust +lsp +tree-sitter) - (scheme +racket) + ;; (scheme +racket) (sh +lsp +tree-sitter) (web +lsp +tree-sitter) - (yaml +lsp +tree-sitter) + (yaml +tree-sitter) (zig +lsp +tree-sitter) :email @@ -122,7 +118,7 @@ :app calendar ;; emms - ;; everywhere + everywhere irc (rss +org) diff --git a/modules/nixfiles/emacs/doom/packages.el b/modules/nixfiles/emacs/doom/packages.el index b29ee5f..80651f2 100644 --- a/modules/nixfiles/emacs/doom/packages.el +++ b/modules/nixfiles/emacs/doom/packages.el @@ -1,4 +1,6 @@ -;;; packages.el -*- no-byte-compile: t; -*- +;;; packages.el -*- lexical-binding: t; -*- + +(disable-packages! writegood-mode) (package! hledger-mode) @@ -10,10 +12,8 @@ (package! org-roam :recipe (:host github :repo "org-roam/org-roam" - :branch "main" - :files (:defaults "extensions/*"))) + :branch "main")) (package! org-roam-ui :recipe (:host github :repo "org-roam/org-roam-ui" - :branch "main" - :files ("*.el" "out"))) + :branch "main")) diff --git a/modules/nixfiles/endlessh-go.nix b/modules/nixfiles/endlessh-go.nix index cb9a639..b89ffc4 100644 --- a/modules/nixfiles/endlessh-go.nix +++ b/modules/nixfiles/endlessh-go.nix @@ -3,56 +3,31 @@ inputs, lib, pkgs, + this, ... }: with lib; let cfg = config.nixfiles.modules.endlessh-go; in { - # imports = ["${inputs.nixpkgs-local}/nixos/modules/services/security/endlessh-go.nix"]; + # Remove this later. + imports = ["${inputs.nixpkgs-endlessh-go}/nixos/modules/services/security/endlessh-go.nix"]; - options.nixfiles.modules.endlessh-go = { - enable = mkEnableOption "endlessh-go"; - - prometheusPort = mkOption { - description = "Prometheus port."; - type = with types; port; - default = 9119; - }; - }; + options.nixfiles.modules.endlessh-go.enable = mkEnableOption "endlessh-go"; config = let port = 22; in mkIf cfg.enable { - assertions = [ - { - assertion = !(any (x: x == port) config.services.openssh.ports); - message = "Port ${toString port} is already occupied by OpenSSH"; - } - ]; - - systemd.services.endlessh-go = { - description = "Endlessh SSH Tarpit"; - requires = ["network-online.target"]; - serviceConfig = { - Restart = "always"; - ExecStart = concatStringsSep " " [ - "${pkgs.endlessh-go}/bin/endlessh-go" - "-conn_type=tcp4" - "-host=0.0.0.0" - "-port=${toString port}" - "-enable_prometheus" - "-prometheus_port=${toString cfg.prometheusPort}" - "-geoip_supplier=ip-api" - "-logtostderr" - "-v=1" - ]; - KillSignal = "SIGTERM"; - AmbientCapabilities = "CAP_NET_BIND_SERVICE"; - DynamicUser = true; - StateDirectory = "endlessh-go"; + services.endlessh-go = { + enable = true; + listenAddress = "0.0.0.0"; + inherit port; + prometheus = { + enable = true; + listenAddress = this.wireguard.ipv4.address; + port = 9229; }; - wantedBy = ["multi-user.target"]; + extraOptions = ["-conn_type=tcp4" "-geoip_supplier=ip-api" "-v=1"]; }; networking.firewall.allowedTCPPorts = [port]; diff --git a/modules/nixfiles/profiles/headless.nix b/modules/nixfiles/profiles/headless.nix index 107c9fc..b3c5c86 100644 --- a/modules/nixfiles/profiles/headless.nix +++ b/modules/nixfiles/profiles/headless.nix @@ -59,7 +59,9 @@ in { defaultLocale = mkForce "C"; supportedLocales = mkForce ["en_US.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8"]; }; + services.udisks2.enable = false; + xdg.sounds.enable = false; environment.systemPackages = with pkgs; [alacritty.terminfo]; diff --git a/modules/nixfiles/x11.nix b/modules/nixfiles/x11.nix index ac1b799..502a24b 100644 --- a/modules/nixfiles/x11.nix +++ b/modules/nixfiles/x11.nix @@ -14,21 +14,22 @@ in { hm = { home = { - packages = with pkgs; - [xclip xdotool] - ++ (with xorg; [ - xdpyinfo - xdriinfo - xev - xfontsel - xkill - xlsatoms - xlsclients - xlsfonts - xprop - xrandr - xwininfo - ]); + # TODO Get these out of the global state. + # packages = with pkgs; + # [xclip xdotool] + # ++ (with xorg; [ + # xdpyinfo + # xdriinfo + # xev + # xfontsel + # xkill + # xlsatoms + # xlsclients + # xlsfonts + # xprop + # xrandr + # xwininfo + # ]); sessionVariables = with config.dirs; { XCOMPOSEFILE = "${cache}/XComposeFile"; diff --git a/packages/bruh.nix b/packages/bruh.nix index a555fcc..62fe557 100644 --- a/packages/bruh.nix +++ b/packages/bruh.nix @@ -1,4 +1,5 @@ { + alsa-utils, fetchFromGitHub, stdenv, }: @@ -13,5 +14,10 @@ stdenv.mkDerivation rec { hash = "sha256-Uw6Qes0IZkkfBchFnvnX9l1ZG5T5pyExmV7yUJLPOJ0="; }; + postPatch = '' + substituteInPlace bruh.c \ + --replace "aplay" "${alsa-utils}/bin/aplay" + ''; + makeFlags = ["PREFIX=$(out)"]; } diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix index 90a5865..47b2c49 100644 --- a/packages/nixfiles.nix +++ b/packages/nixfiles.nix @@ -1,9 +1,7 @@ { git, jq, - lib, nix, - nixfilesSrc ? "$HOME/src/nixfiles", openssh, writeShellApplication, }: @@ -11,17 +9,16 @@ writeShellApplication { name = "nixfiles"; runtimeInputs = [git jq nix openssh]; text = '' - nixfiles=${lib.escapeShellArg nixfilesSrc} cmd="$1" shift - case $cmd in + case "$cmd" in update) if (( $# )); then args=() for input do args+=(--update-input "$input"); done - exec nix flake lock "$nixfiles" "''${args[@]}" + exec nix flake lock "." "''${args[@]}" else - exec nix flake update -v "$nixfiles" + exec nix flake update -v "." fi ;; rev) @@ -35,7 +32,7 @@ writeShellApplication { repl|eval|build) args=() for arg do case $arg in - -w|--wip) args+=(--override-flake config "$nixfiles") + -w|--wip) args+=(--override-flake config ".") ;; *) args+=("$arg") esac done @@ -53,29 +50,23 @@ writeShellApplication { home) attr="nixosConfigurations.$HOSTNAME.config.hm.home.activationPackage" export VERBOSE=1 - exec nix shell --verbose "$nixfiles#$attr" "$@" --command home-manager-generation + exec nix shell --verbose ".#$attr" "$@" --command home-manager-generation ;; specialise) - name=$1 + name="$1" shift exec sudo /run/current-system/specialisation/"$name"/bin/switch-to-configuration switch ;; revert) exec sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch ;; - test-headless) - exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headless" "$@" - ;; - test-headful) - exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headful" "$@" - ;; @*) host="''${cmd#@}" hostname="$(ssh -q "$host" 'echo "$HOSTNAME"')" - exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo "$@" + exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo "$@" ;; *) - exec nixos-rebuild -v --flake "$nixfiles" --use-remote-sudo "$cmd" "$@" + exec nixos-rebuild -v --flake . --use-remote-sudo "$cmd" "$@" ;; esac ''; |