make flake inputs available in nixos, use merged remote-exec

This commit is contained in:
Peder Bergebakken Sundt 2023-07-03 01:26:21 +02:00
parent 776bead26e
commit 41785098de
3 changed files with 35 additions and 61 deletions

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1687163790,
"narHash": "sha256-CmG/ZdswJrWM0CMgJiVyWfO6LqaI4SKEAx9IrnYDrpI=",
"lastModified": 1687871164,
"narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ac53777f52929bc82efcd2830bfc5aa60bcb4337",
"rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38",
"type": "github"
},
"original": {
@ -65,11 +65,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1687466461,
"narHash": "sha256-oupXI7g7RPzlpGUfAu1xG4KBK53GrZH8/xeKgKDB4+Q=",
"lastModified": 1688177999,
"narHash": "sha256-JZ5nk90Ym79b4J593xYb0mI79QxU0efJLuCU3sXDalQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ecb441f22067ba1d6312f4932a7c64efa8d19a7b",
"rev": "0de86059128947b2438995450f2c2ca08cc783d5",
"type": "github"
},
"original": {
@ -111,20 +111,6 @@
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1686462208,
"narHash": "sha256-L58OUbCXtIzlBJ5QQBETWgPFgmekOwW99LhiyUp9Cto=",
"owner": "nix-community",
"repo": "NUR",
"rev": "416eb10d0850d5041169b70e57df91206f7a613d",
"type": "github"
},
"original": {
"id": "nur",
"type": "indirect"
}
},
"pbsds-papers": {
"inputs": {
"katex": "katex",
@ -133,11 +119,11 @@
"nixpkgs-unstable": "nixpkgs-unstable"
},
"locked": {
"lastModified": 1686683023,
"narHash": "sha256-jRBUWc0Ct3CDA20lBD5Oybhita7bssCxa+e2iRg0FCY=",
"lastModified": 1688109359,
"narHash": "sha256-HqBfhPqskDNBYT55Rzs7GmAPqqreOcjEf6/eB5sEZ2Q=",
"ref": "refs/heads/main",
"rev": "654f1b1002e17d140423bc73438637073ad767ca",
"revCount": 438,
"rev": "c2874a2d959b3bdb1d822b35f34a90380b5b484f",
"revCount": 441,
"type": "git",
"url": "ssh://git@github.com/pbsds/papers.git"
},
@ -162,41 +148,23 @@
"type": "github"
}
},
"pr-remote-exec": {
"locked": {
"lastModified": 1681506994,
"narHash": "sha256-GQmdJqXACW7Jmf1NPyu+pO1iuyyFXxbYh4Q6JmY3iMU=",
"owner": "pbsds",
"repo": "nixpkgs",
"rev": "3be9b13e0e87c5f35ada163c9c2fd4cf2d9a9560",
"type": "github"
},
"original": {
"owner": "pbsds",
"ref": "remote-exec-init",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nur": "nur",
"pbsds-papers": "pbsds-papers",
"pr-polaris14": "pr-polaris14",
"pr-remote-exec": "pr-remote-exec",
"unstable": "unstable"
}
},
"unstable": {
"locked": {
"lastModified": 1687412861,
"narHash": "sha256-Z/g0wbL68C+mSGerYS2quv9FXQ1RRP082cAC0Bh4vcs=",
"lastModified": 1688231357,
"narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e603dc5f061ca1d8a19b3ede6a8cf9c9fcba6cdc",
"rev": "645ff62e09d294a30de823cb568e9c6d68e92606",
"type": "github"
},
"original": {

View File

@ -29,7 +29,6 @@
# temporary stuff i want to use
# TODO: can i fetch a subset of files of these?
pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14";
pr-remote-exec.url = "github:pbsds/nixpkgs/remote-exec-init";
};
outputs = {
@ -37,7 +36,6 @@
nixpkgs,
unstable,
nixos-hardware,
nur,
home-manager,
...
} @ inputs:
@ -47,10 +45,19 @@
"aarch64-linux"
#"riscv64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f {
flake = system: nixpkgs.lib.mapAttrs (name: flake: {
# TODO filter non-flake inputs
lib = flake.lib.${system} or null;
nixos = flake.nixosModules or null;
pkgs = flake.packages.${system}
or flake.legacyPackages.${system}
or null;
}) inputs;
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib;
flakes = flake system;
});
# TODO: move unstable here?
@ -60,14 +67,13 @@
nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ?
polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { };
polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { };
remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" { };
})];
};
mkConfig = hostname: domain: system: modules: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
packages = self.packages.${system};
flakes = flake system;
};
modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({
home-manager.extraSpecialArgs = {
@ -101,7 +107,6 @@
packages = forAllSystems({ pkgs, ... }: {
mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # https://github.com/NixOS/nixpkgs/pull/238659
remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {};
});
nixosConfigurations = let nm = nixos-hardware.nixosModules; in {
@ -126,7 +131,7 @@
pbsds-gnome = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home/gnome.nix ];
});
devShells = forAllSystems ({ system, pkgs, ... }: let
devShells = forAllSystems ({ pkgs, flakes, ... }: let
mkShell = packages: pkgs.mkShell { inherit packages; };
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom
@ -140,8 +145,9 @@
in {
envrc-local = mkShell envrc-pkgs;
envrc-remote = mkShell(envrc-pkgs ++ [
self.packages.${system}.remote-exec
flakes.unstable.pkgs.remote-exec
pkgs.yq
pkgs.rsync
]);
remoteenv = mkShell [
nixos-rebuild-nom

View File

@ -1,4 +1,4 @@
{ pkgs, packages, ... }:
{ pkgs, flakes, ... }:
{
#home.packages = with pkgs; [ mpv ];
@ -11,7 +11,7 @@
#thumbnail # TOO SLOW
#mpris
# TODO: thumbfast
packages.mpv-webm # activate with SHIFT+w
flakes.self.pkg.mpv-webm # activate with SHIFT+w
# from https://github.com/mpv-player/mpv/issues/9767#issuecomment-1024831645
({ scriptName = "dynamic-subs.lua"; } // (pkgs.writeTextDir "share/mpv/scripts/dynamic-subs.lua" ''
mp.add_hook('on_load', 10, function()