forked from Mic92/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
outputs.nix
75 lines (71 loc) · 1.97 KB
/
outputs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ self
, nixpkgs
, nixos-hardware
, sops-nix
, nur
, home-manager
, retiolum
, flake-utils
, krops
, flake-registry
, bme680-mqtt
, nix-ld
, doom-emacs
, nix-doom-emacs
}:
(flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
nurPkgs = import nur {
inherit pkgs;
nurpkgs = pkgs;
};
in {
devShell = pkgs.callPackage ./shell.nix {};
# deploy like this:
# nix run ".#deploy.turingmachine"
# nix run ".#deploy.eve"
apps.deploy = pkgs.callPackage ./nixos/krops.nix {
inherit (krops.packages.${system}) writeCommand;
lib = krops.lib;
};
apps.irc-announce = nurPkgs.repos.mic92.irc-announce;
apps.hm-switch = pkgs.writeScriptBin "hm-flake-switch" ''
#!${pkgs.runtimeShell}
tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
declare -A profiles=(["turingmachine"]="desktop" ["eddie"]="desktop" ["eve"]="eve")
profile=''${profiles[$HOSTNAME]}
flake=$(nix flake info --json ${./.} | ${pkgs.jq}/bin/jq -r .url)
nix build --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile:-common}.activationPackage"
link=$(realpath $tmpdir/result)
$link/activate
'';
})) // {
nixosConfigurations = import ./nixos/configurations.nix {
#nixpkgs = toString <nixpkgs>;
# for testing
#nixosSystem = import <nixpkgs/nixos/lib/eval-config.nix>;
inherit nixpkgs;
nixosSystem = nixpkgs.lib.nixosSystem;
inherit
nur
home-manager
sops-nix
retiolum
nixos-hardware
flake-registry bme680-mqtt
nix-ld;
};
hmConfigurations = import ./nixpkgs-config/homes.nix {
inherit self nixpkgs home-manager nur;
};
hydraJobs = {
configurations =
nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair name config.config.system.build.toplevel)
self.nixosConfigurations;
hmConfigurations = nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair name config.activation-script)
self.hmConfigurations;
};
}