diff --git a/.envrc b/.envrc index d36a344..ac13960 100644 --- a/.envrc +++ b/.envrc @@ -9,6 +9,12 @@ if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; the echo "$now" > .direnv/pull-date fi -if ! command -v nixos-rebuild >/dev/null; then - use nix +if test -s .remote.toml; then + use flake .#remote + echo + echo "Current remote: $(remote-host)" + tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r + echo +elif ! command -v nixos-rebuild >/dev/null; then + use flake .#non-nixos fi diff --git a/README.md b/README.md index 85120f0..c742662 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ * [x] Make a flake * [x] merge hosted docs into a single subdomain * [ ] autogenerate ssh keys +* [ ] switch to systemd networkd * [ ] pre-commit hook with 'nix eval ...outPath' * [ ] use `nom` when deploying * [ ] figure out how to reuse system flake lock while deplying, leave the night job to upgrade diff --git a/cheatsheet.md b/cheatsheet.md index f16687b..6fc65d2 100644 --- a/cheatsheet.md +++ b/cheatsheet.md @@ -15,7 +15,7 @@ Via git, build on remote: Via `remote-exec`, build on remote: - nix shell .#remote-exec + nix develop .#remote remote-set FOOBAR remote sudo nixos-rebuild test --flake . --recreate-lock-file --no-write-lock-file diff --git a/flake.nix b/flake.nix index b29db70..2e959a5 100644 --- a/flake.nix +++ b/flake.nix @@ -26,12 +26,15 @@ ... } @ inputs: let + nixlib = nixpkgs.lib; systems = [ "x86_64-linux" "aarch64-linux" #"riscv64-linux" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); + overlays = nixlib.mapAttrsToList (name: val: val) self.overlays; + tmpConfig = { disabledModules = [ "services/misc/polaris.nix" ]; imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ]; @@ -67,18 +70,45 @@ })]; }; in { + inherit inputs; + + overlays.remote-exec = (final: prev: { + remote-exec = prev.python3Packages.callPackage ./pkgs/remote-exec.nix {}; + }); + + packages = forAllSystems(system: + let pkgs = import nixpkgs { inherit system overlays; }; + in { inherit (pkgs) remote-exec; } + ); + nixosConfigurations.noximilien = mkConfig "noximilien" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]); nixosConfigurations.bolle = mkConfig "bolle" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]); nixosConfigurations.nord = mkConfig "nord" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-amd ]); + homeConfigurations = forAllSystems (system: { pbsds = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; modules = [ ./users/pbsds/home ]; }; }); - devShells = forAllSystems (system: { - default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { }; + + devShells = forAllSystems (system: { # TODO: apply my overlays? + non-nixos = nixpkgs.legacyPackages.${system}.mkShell { + packages = with nixpkgs.legacyPackages.${system}; [ + nix-output-monitor + nixos-rebuild + home-manager + ]; + }; + remote = nixpkgs.legacyPackages.${system}.mkShell { + packages = with nixpkgs.legacyPackages.${system}; [ + nix-output-monitor + self.packages.${system}.remote-exec + yq + ]; + }; }); + }; } diff --git a/profiles/remote-builders/default.nix b/profiles/remote-builders/default.nix index 2775d17..4de2db1 100644 --- a/profiles/remote-builders/default.nix +++ b/profiles/remote-builders/default.nix @@ -1,10 +1,10 @@ { config, pkgs, lib, ... }: let - #supportedFeatures: - # - "kvm" - has hypervisor - # - "nixos-test" - the same as ^? nixos? - # - "benchmark" - has "equal" performance - # - "big-parallel" - is beefy, for stuff like llvm + # supportedFeatures: + # - "kvm" - has hypervisor + # - "nixos-test" - the same as ^? nixos? + # - "benchmark" - has "equal" performance + # - "big-parallel" - is beefy, for stuff like llvm # find 'publicKey' with `ssh-keyscan` diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 79711d6..0000000 --- a/shell.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs ? import {} }: -pkgs.mkShell { - packages = with pkgs; [ - #buildInputs = with pkgs; [ - nixos-rebuild - home-manager - ]; -} diff --git a/users/pbsds/home/profiles/mpv.nix b/users/pbsds/home/profiles/mpv.nix index 6baac61..a90c9eb 100644 --- a/users/pbsds/home/profiles/mpv.nix +++ b/users/pbsds/home/profiles/mpv.nix @@ -1,5 +1,7 @@ { pkgs, ... }: { + #home.packages = with pkgs; [ mpv ]; + programs.mpv.enable = true; programs.mpv.bindings."n" = "sub-seek 1"; programs.mpv.bindings."SHIFT+n" = "sub-seek -1"; diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix index 1d9435a..e723a69 100644 --- a/users/pbsds/home/profiles/shell.nix +++ b/users/pbsds/home/profiles/shell.nix @@ -84,6 +84,4 @@ complete -F _command tldr fi ''; - - }