-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
129 lines (118 loc) · 3.71 KB
/
flake.nix
File metadata and controls
129 lines (118 loc) · 3.71 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
description = "Home Manager configuration of seroperson";
nixConfig = {
experimental-features = [ "nix-command" "flakes" ];
};
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs = {
url = "github:nixos/nixpkgs/release-25.11";
};
nixpkgs-unstable = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
myHomeManagerConfiguration = { useSymlinks, homeDirectory, username, dotfilesDirectory }@extraSpecialArgs:
home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules = [
./home.nix
{
nixpkgs.overlays = [
(self: super: rec {
# myJdk = nixpkgs-unstable.legacyPackages.${system}.jdk24;
myJdk = self.jdk21;
# myJdk = self.jdk17;
jdk = myJdk;
jre = myJdk;
mill = super.mill.override {
jre = myJdk;
};
gradle_9 = super.mill.override {
jre = myJdk;
};
tmux = nixpkgs-unstable.legacyPackages.${system}.tmux;
unstable = import nixpkgs-unstable {
inherit (self.stdenv.hostPlatform) system;
inherit (self) config;
};
})
];
}
];
};
in
{
devShells.${system}.default = pkgs.mkShell rec {
homeDirectory = builtins.getEnv "HOME";
username = builtins.getEnv "USER";
activationPackage = (myHomeManagerConfiguration {
inherit homeDirectory username;
useSymlinks = false;
dotfilesDirectory = "";
}).activationPackage;
buildInputs = [
activationPackage
pkgs.nix
];
shellHook = ''
export HOME=${homeDirectory}
export USER=${username}
# Fixes `Could not find suitable profile directory` error
mkdir -p ${homeDirectory}/.local/state/nix/profiles
${activationPackage}/activate
# Run zsh and then exit
IS_PREVIEW=1 exec $HOME/.nix-profile/bin/zsh
'';
};
packages.${system}.docker = (import ./nix/docker.nix {
pkgs = pkgs;
name = "seroperson.me/dotfiles";
tag = "latest";
extraPkgs = with pkgs; [
ps
gnused
coreutils
];
extraContents = [
(myHomeManagerConfiguration {
useSymlinks = false;
homeDirectory = "/root";
username = "root";
dotfilesDirectory = "";
}).activationPackage
];
extraEnv = [ "IS_PREVIEW=1" ];
rootShell = "/root/.nix-profile/bin/zsh";
cmd = [ "/bin/sh" "-c" "/activate && exec /root/.nix-profile/bin/zsh" ];
nixConf = {
allowed-users = [ "*" ];
experimental-features = [
"nix-command"
"flakes"
];
max-jobs = [ "auto" ];
sandbox = "false";
trusted-users = [
"root"
];
};
});
homeConfigurations = {
"seroperson" = myHomeManagerConfiguration {
useSymlinks = true;
homeDirectory = "/home/seroperson/";
username = "seroperson";
dotfilesDirectory = "/home/seroperson/.dotfiles";
};
};
};
}