Skip to content

Commit 6d3561b

Browse files
Copilotjeremystucki
andcommitted
Further modularize configuration by extracting desktop and security modules
Co-authored-by: jeremystucki <7629727+jeremystucki@users.noreply.github.com>
1 parent f36d964 commit 6d3561b

4 files changed

Lines changed: 64 additions & 77 deletions

File tree

common/1password.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
config,
3+
pkgs,
4+
pkgs-unstable,
5+
hostConfiguration,
6+
...
7+
}: {
8+
programs._1password = {
9+
enable = true;
10+
package = pkgs-unstable._1password-cli;
11+
};
12+
13+
programs._1password-gui = {
14+
enable = true;
15+
package = pkgs-unstable._1password-gui;
16+
polkitPolicyOwners = [hostConfiguration.username];
17+
};
18+
19+
programs.ssh.extraConfig = ''
20+
Host *
21+
IdentityAgent ${config.users.users.${hostConfiguration.username}.home}/.1password/agent.sock
22+
'';
23+
24+
systemd.user.services._1password = {
25+
script = "${pkgs._1password-gui}/bin/1password --silent";
26+
after = ["graphical-session.target"];
27+
partOf = ["graphical-session.target"];
28+
wantedBy = ["graphical-session.target"];
29+
};
30+
}

common/desktop-gnome.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{...}: {
2+
services.xserver = {
3+
enable = true;
4+
5+
xkb = {
6+
layout = "us";
7+
variant = "";
8+
};
9+
10+
displayManager.gdm.enable = true;
11+
desktopManager.gnome.enable = true;
12+
};
13+
14+
services.pulseaudio.enable = false;
15+
security.rtkit.enable = true;
16+
services.pipewire = {
17+
enable = true;
18+
alsa.enable = true;
19+
alsa.support32Bit = true;
20+
pulse.enable = true;
21+
};
22+
23+
# Enable OpenGL
24+
hardware.graphics = {
25+
enable = true;
26+
enable32Bit = true;
27+
};
28+
29+
environment.sessionVariables.NIXOS_OZONE_WL = "1";
30+
}

common/nixos.nix

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,6 @@
4444
};
4545
};
4646

47-
services.xserver = {
48-
enable = true;
49-
50-
xkb = {
51-
layout = "us";
52-
variant = "";
53-
};
54-
55-
displayManager = {
56-
gdm.enable = true;
57-
};
58-
desktopManager = {
59-
gnome.enable = true;
60-
};
61-
};
62-
6347
services.openssh.enable = true;
6448
services.printing.enable = true;
6549
services.tailscale.enable = true;
@@ -71,21 +55,6 @@
7155
"hmac-sha2-512"
7256
];
7357

74-
services.pulseaudio.enable = false;
75-
security.rtkit.enable = true;
76-
services.pipewire = {
77-
enable = true;
78-
alsa.enable = true;
79-
alsa.support32Bit = true;
80-
pulse.enable = true;
81-
# If you want to use JACK applications, uncomment this
82-
#jack.enable = true;
83-
84-
# use the example session manager (no others are packaged yet so this is enabled by default,
85-
# no need to redefine it in your config for now)
86-
#media-session.enable = true;
87-
};
88-
8958
services.ratbagd.enable = true;
9059

9160
virtualisation.docker.enable = true;
@@ -95,69 +64,25 @@
9564
defaultNetwork.settings.dns_enabled = true;
9665
};
9766

98-
# Some programs need SUID wrappers, can be configured further or are
99-
# started in user sessions.
100-
# programs.mtr.enable = true;
101-
# programs.gnupg.agent = {
102-
# enable = true;
103-
# enableSSHSupport = true;
104-
# };
105-
10667
hardware.i2c.enable = true;
10768

108-
# Enable OpenGL
109-
hardware.graphics = {
110-
enable = true;
111-
enable32Bit = true;
112-
};
113-
11469
fonts.packages = with pkgs; [
11570
pkgs.nerd-fonts.jetbrains-mono
11671
input-fonts
11772
];
11873

11974
programs.steam.enable = true;
120-
121-
programs._1password = {
122-
enable = true;
123-
package = pkgs-unstable._1password-cli;
124-
};
125-
126-
programs._1password-gui = {
127-
enable = true;
128-
package = pkgs-unstable._1password-gui;
129-
130-
# Certain features, including CLI integration and system authentication support,
131-
# require enabling PolKit integration on some desktop environments (e.g. Plasma).
132-
polkitPolicyOwners = [hostConfiguration.username];
133-
};
134-
13575
programs.adb.enable = true;
13676

137-
programs.ssh.extraConfig = ''
138-
Host *
139-
IdentityAgent ${config.users.users.${hostConfiguration.username}.home}/.1password/agent.sock
140-
'';
141-
142-
systemd.user.services._1password = {
143-
script = "${pkgs._1password-gui}/bin/1password --silent";
144-
after = ["graphical-session.target"];
145-
partOf = ["graphical-session.target"];
146-
wantedBy = ["graphical-session.target"];
147-
};
148-
14977
systemd.user.services.tmux = {
15078
script = "${pkgs.tmux}/bin/tmux new-session -d";
15179
wantedBy = ["default.target"];
15280
serviceConfig.Type = "forking";
15381
};
15482

155-
environment.sessionVariables = {
156-
NIXOS_OZONE_WL = "1";
157-
TZDIR = "/etc/zoneinfo";
158-
};
159-
16083
virtualisation.virtualbox.host.enable = true;
16184
users.extraGroups.vboxusers.members = [hostConfiguration.username];
16285
boot.kernelModules = ["vboxnetflt" "vboxnetadp"];
86+
87+
environment.sessionVariables.TZDIR = "/etc/zoneinfo";
16388
}

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
modules = [
6565
{nixpkgs.pkgs = pkgs;}
6666
./common/nixos.nix
67+
./common/desktop-gnome.nix
68+
./common/1password.nix
6769
./common/nix-settings.nix
6870
nixosModule
6971
inputs.color-scheme-sync.nixosModules.default

0 commit comments

Comments
 (0)