flake-based devshell

This commit is contained in:
Peder Bergebakken Sundt 2023-03-09 07:03:15 +01:00
parent 8f0c82e8db
commit fa6a69fe58
8 changed files with 49 additions and 20 deletions

10
.envrc
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
];
};
});
};
}

View File

@ -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`

View File

@ -1,8 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = with pkgs; [
#buildInputs = with pkgs; [
nixos-rebuild
home-manager
];
}

View File

@ -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";

View File

@ -84,6 +84,4 @@
complete -F _command tldr
fi
'';
}