-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
111 lines (103 loc) · 3.24 KB
/
flake.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
description = "Home Manager configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, nixpkgs-unstable, home-manager, nix-index-database, ... }@inputs:
let
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssl-1.1.1w" # sublime4
];
};
overlays = [
(final: prev: {
local = import ./pkgs {
pkgs = final;
lib = prev.lib;
};
})
(final: prev: {
unstable = import nixpkgs-unstable {
system = final.system;
config = config;
};
})
];
mkConfig =
{ hostname, username, system, homeDirectory, ... }:
let
defaultConfig = { pkgs, ... }: {
nixpkgs.overlays = overlays;
nixpkgs.config = config;
programs.home-manager.enable = true;
targets.genericLinux.enable = pkgs.stdenv.isLinux;
home.username = username;
home.homeDirectory = homeDirectory;
home.stateVersion = "24.11";
news.display = "silent";
};
in
home-manager.lib.homeManagerConfiguration {
# home-manager will be responsible for evaluating the nixpkgs.overlays.
# We're passing legacyPackages here to avoid nixpkgs from being
# evaluated twice.
#
# Ref:
# home-manager/modules/modules.nix (`pkgPath = ...;')
# home-manager/modules/misc/nixpkgs.nix (`import pkgPath ...;')
pkgs = nixpkgs.legacyPackages.${system};
modules = [
defaultConfig
./lib/flatpak.nix
./lib/machine.nix
./lib/runit/runit.nix
./lib/runit/wayexec.nix
./modules/machines/${hostname}.nix
nix-index-database.hmModules.nix-index
];
};
mkLinuxConfig =
{ hostname
, username ? "sirn"
, system ? "x86_64-linux"
, homeDirectory ? "/home/${username}"
, ...
}:
mkConfig {
inherit hostname username system homeDirectory;
};
mkDarwinConfig =
{ hostname
, username ? "sirn"
, system ? "aarch64-darwin"
, homeDirectory ? "/Users/${username}"
, ...
}:
mkConfig {
inherit hostname username system homeDirectory;
};
in
{
homeConfigurations = {
helios = mkLinuxConfig { hostname = "helios"; };
phoebe = mkLinuxConfig { hostname = "phoebe"; };
polaris = mkLinuxConfig { hostname = "polaris"; };
pyxis = mkDarwinConfig { hostname = "pyxis"; };
terra = mkLinuxConfig { hostname = "terra"; };
theia = mkDarwinConfig { hostname = "theia"; };
vega = mkLinuxConfig { hostname = "vega"; };
ws = mkLinuxConfig { hostname = "ws"; };
};
};
}