1 { config, pkgs, lib, inputs, hostName, ... }:
4 ../nixos/profiles/builder.nix
5 ../nixos/profiles/debug.nix
6 ../nixos/profiles/graphical.nix
7 ../nixos/profiles/lang-fr.nix
8 ../nixos/profiles/printing.nix
9 ../nixos/profiles/security.nix
10 ../nixos/profiles/system.nix
11 ../nixos/profiles/tor.nix
12 ../nixos/profiles/irssi.nix
18 # Lower kernel's security for better performances
19 boot.kernelParams = [ "mitigations=off" ];
21 home-manager.users.julm = {
22 imports = [ ../homes/julm.nix ];
24 systemd.services.home-manager-julm.postStart = ''
25 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/julm/home-manager
28 openssh.authorizedKeys.keys = map lib.readFile [
29 # For nix -L run .#oignon.switch
30 ../users/julm/ssh/oignon.pub
36 # Put the hashedPassword in /nix/store,
37 # though /etc/shadow is not world readable...
38 # printf %s $(mkpasswd -m md5crypt)
39 hashedPassword = lib.readFile oignon/users/julm/login/hashedPassword.clear;
50 config.services.davfs2.davGroup
53 # If created, zfs-mount.service would require:
54 # zfs set overlay=yes ${hostName}/home
56 openssh.authorizedKeys.keys = map lib.readFile [
57 ../users/julm/ssh/losurdo.pub
61 systemd.services.nix-daemon.serviceConfig.LoadCredentialEncrypted =
62 [ ("${hostName}.key:" + inputs.self + "/hosts/${hostName}/nix/secret-key-files.priv.pem.cred") ];
65 secret-key-files = /run/credentials/nix-daemon.service/${hostName}.key
68 trusted-users = [ config.users.users."julm".name ];
70 #"http://nix-localcache.losurdo.wg"
71 "ssh://nix-ssh@losurdo.wg?priority=30"
73 trusted-public-keys = map lib.readFile [
74 ../hosts/losurdo/nix/key.pub
77 nixPath = lib.mkForce [ "nixpkgs=${inputs.nixpkgs}" ];
79 #environment.etc."nixpkgs".source = pkgs.path;
80 #environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
82 nix.settings.allowed-users = [ config.users.users."nix-ssh".name ];
85 keys = map lib.readFile [
86 ../users/julm/ssh/losurdo.pub
87 ../users/julm/ssh/oignon.pub
88 ../users/sevy/ssh/patate.pub
92 #security.systemd-creds.shell = [ "sudo" ];
93 security.systemd-creds.encrypt = [ "systemd-creds" "encrypt" "--name" "\"$credID\"" "--with-key=host" ];
95 environment.systemPackages = [
96 pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
99 boot.extraModulePackages = [
100 #config.boot.kernelPackages.v4l2loopback
103 programs.fuse.userAllowOther = true;
105 services.davfs2.enable = true;
108 # Use the user's gpg-agent session to query
109 # for the password of the SSH key when auto-mounting.
112 pkgs.writeScript "sshAsUser-${user}" ''
113 exec ${pkgs.sudo}/bin/sudo -i -u ${user} \
114 ${pkgs.openssh}/bin/ssh "$@"
118 "noatime" "noexec" "nosuid"
119 "user" "uid=julm" "gid=users" "allow_other"
120 "_netdev" "ssh_command=${sshAsUser "julm"}" # "reconnect"
121 "noauto" "x-gvfs-hide" "x-systemd.automount"
122 #"Compression=yes" # YMMV
123 # Disconnect approximately 2*15=30 seconds after a network failure
124 "ServerAliveCountMax=1"
125 "ServerAliveInterval=15"
129 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.wg:/";
134 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@losurdo.wg:/";
139 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@mermet.wg:/";
143 "/mnt/ilico/severine" = {
144 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
147 let conf = pkgs.writeText "davfs2.conf" ''
148 backup_dir /home/julm/.local/share/davfs2/ilico/severine
149 secrets /home/julm/.davfs2/secrets
151 [ "conf=${conf}" "user" "noexec" "nosuid"
152 "noauto" "nofail" "_netdev" "reconnect"
153 "x-systemd.automount"
154 "x-systemd.device-timeout=1m"
155 "x-systemd.idle-timeout=1m"
156 "x-systemd.mount-timeout=10s"
161 networking.firewall.extraCommands = ''
162 ip46tables -A nixos-fw -i wg-intra -p tcp -m tcp --dport 8000 -j ACCEPT
167 defaultMode = "online";
170 localDiscovery = false;
172 Datastore.StorageMax = "10GB";
173 Discovery.MDNS.Enabled = false;
176 #Swarm.AddrFilters = null;
178 startWhenNeeded = true;
181 services.udev.packages = [
182 # Allow the console user access the Yubikey USB device node,
183 # needed for challenge/response to work correctly.
184 pkgs.yubikey-personalization
190 # Let the session be generated by home-manager
191 { name = "home-manager";
193 ${pkgs.runtimeShell} $HOME/.hm-xsession &
200 defaultSession = "home-manager";
201 #defaultSession = "none+xmonad";
202 #defaultSession = "mate";
203 #defaultSession = "cinnamon";
205 user = config.users.users.julm.name;
210 # This value determines the NixOS release with which your system is to be
211 # compatible, in order to avoid breaking some software such as database
212 # servers. You should change this only after NixOS release notes say you should.
213 system.stateVersion = "20.09"; # Did you read the comment?