18 Commits
main ... sops

Author SHA1 Message Date
John Lancaster
706e9ee95f added uv 2025-07-07 18:02:13 -05:00
John Lancaster
2ebdda4ab4 secret change 2025-07-07 01:15:08 -05:00
John Lancaster
be5a15f3d4 moved sops stuff into sops.nix 2025-07-07 01:10:11 -05:00
John Lancaster
cc396c2daf actually enabled sops 2025-07-07 01:04:48 -05:00
John Lancaster
1fe7f9b901 redid path 2025-07-07 00:53:56 -05:00
John Lancaster
5f3d3a224a fixed inputs for sops 2025-07-07 00:31:27 -05:00
John Lancaster
7eb20ee07d started secrets file 2025-07-07 00:24:22 -05:00
John Lancaster
460f0d132d added sops 2025-07-07 00:22:25 -05:00
John Lancaster
5d5b15fb63 singular lib.optional 2025-07-06 23:59:40 -05:00
John Lancaster
92067f8b69 using mkMerge now 2025-07-06 23:54:22 -05:00
John Lancaster
cc21dcdc92 added sublime and joplin options 2025-07-06 23:47:05 -05:00
John Lancaster
ac9e58ede6 fixed pathss 2025-07-06 23:11:25 -05:00
John Lancaster
be57ba16dd made plugin sciprt optional 2025-07-06 23:08:07 -05:00
John Lancaster
2fd6a2c04a moved keys 2025-07-06 23:07:54 -05:00
John Lancaster
09e941abbd broke out common logic 2025-07-06 21:52:22 -05:00
John Lancaster
e21c901e94 moved options together 2025-07-06 21:42:40 -05:00
John Lancaster
ce738ae612 started splitting up graphical programs because some of them don't really work well on ubuntu 2025-07-06 21:39:41 -05:00
John Lancaster
ddf5bcaeee updated module example 2025-07-06 19:37:15 -05:00
13 changed files with 160 additions and 68 deletions

9
.sops.yaml Normal file
View File

@@ -0,0 +1,9 @@
keys:
- &john-p14s age1f6drjusg866yscj8029tk4yfpgecklrvezldm02ankm6h8nnwu5s2u6ahy
- &john-pc age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt
creation_rules:
- path_regex: secrets.yaml$
key_groups:
- age:
- *john-p14s
- *john-pc

View File

@@ -40,42 +40,54 @@ nhmu
```nix
{
description = "Home Manager configuration of john";
description = "John's system flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
jsl-home = {
url = "git+https://gitea.john-stream.com/john/jsl-home?ref=dev";
inputs.nixpkgs.follows = "nixpkgs";
};
john-home-config = {
url = "path:/home/john/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs =
{ nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
homeManagerConfiguration = inputs.home-manager.lib.homeManagerConfiguration;
jslDefault = inputs.john-home-config.homeManagerModules.default;
userName = "john";
in
{
homeConfigurations."${userName}" = homeManagerConfiguration {
inherit pkgs;
modules = [
jslDefault {
user = "${userName}";
# Add any additional configuration here
}
./home.nix
# Add other home manager modules here
];
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
nixosSystem = nixpkgs.lib.nixosSystem;
hostName = "john-p14s";
in
{
nixosConfigurations.${hostName} = nixosSystem {
specialArgs =
{
inherit inputs;
inherit system;
};
modules = [
./hardware-configuration.nix
./configuration.nix
inputs.jsl-home.nixosModules.default
{
stateVersion = "24.05";
user = "john";
root = true;
ssh = true;
profile = "personal";
enableShell = true;
_1password = true;
docker = true;
graphical = {
steam = true;
vscode = true;
};
extraImports = [
./home-manager/john.nix
./home-manager/gnome.nix
./home-manager/ssh.nix
];
}
];
};
};
}
```

View File

@@ -12,6 +12,10 @@
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, ... }@inputs:
@@ -22,12 +26,15 @@
# These will get applied to both the configured user and the root user (if enabled)
userOptions = config: {
openssh.authorizedKeys.keyFiles = lib.optionals config.ssh [ ./personal_keys ];
openssh.authorizedKeys = lib.mkIf config.ssh (lib.mkMerge [
(lib.mkIf (config.profile == "personal") { keyFiles = [ ./keys/personal ]; })
(lib.mkIf (config.profile == "work") { keyFiles = [ ./keys/work ]; })
]);
shell = lib.mkIf config.enableShell pkgs.zsh;
};
mkhomeManagerModules = config: [
self.homeManagerModules.default
(self.homeManagerModules.default inputs)
# { inherit (config) extraImports; }
{
user = config.user;
@@ -38,7 +45,6 @@
_1password = config._1password;
docker = config.docker;
graphical = config.graphical;
steam = config.steam;
}
] ++ config.extraImports;
@@ -46,7 +52,9 @@
{
lib = { inherit mkhomeManagerModules; };
homeManagerModules.default = { ... }: { imports = [ ./homeManagerModules ]; };
homeManagerModules.default = inputs: {
imports = [ ./homeManagerModules ];
};
nixosModules.default = { config, ... }: {
imports = [
@@ -54,14 +62,17 @@
inputs.home-manager.nixosModules.default
];
nix.settings.trusted-users = [ "root" "@wheel" ];
users.users.${config.user} = {
isNormalUser = true;
description = "John Lancaster";
extraGroups = []
++ lib.optionals config.root [ "wheel" ]
++ lib.optionals config.docker [ "docker" ]
++ lib.optionals config.networking.networkmanager.enable [ "networkmanager" ];
} // userOptions config;
users.users.${config.user} = lib.mkMerge [
{
isNormalUser = true;
description = "John Lancaster";
extraGroups = []
++ lib.optional config.root "wheel"
++ lib.optional config.docker "docker"
++ lib.optional config.networking.networkmanager.enable "networkmanager";
}
(userOptions config)
];
users.users.root = lib.mkIf config.root (userOptions config);
security.sudo-rs = lib.mkIf config.root {

View File

@@ -6,6 +6,7 @@
./ghostty.nix
./git.nix
./shell.nix
./sops.nix
./ssh.nix
./vscode.nix
@@ -52,7 +53,7 @@
lazygit
btop
yazi
sops
uv
(writeShellScriptBin "nhmu" ''
nix flake update --flake ~/.config/home-manager
nix run home-manager -- switch --flake ~/.config/home-manager --impure
@@ -62,15 +63,10 @@
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
] ++ lib.optionals config.graphical [
discord
spotify
sublime4
joplin-desktop
] ++ lib.optionals config._1password [
_1password-cli
gh # GitHub CLI with 1Password integration
];
]
++ lib.optional config.graphical.discord discord
++ lib.optional config.graphical.joplin joplin-desktop
++ lib.optional config.graphical.sublime sublime4;
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a

View File

@@ -1,6 +1,6 @@
{ config, pkgs, lib, nixgl, ... }:
{
home.sessionVariables = lib.mkIf (config.enableShell && config.graphical) {
home.sessionVariables = lib.mkIf (config.enableShell && config.graphical.ghostty) {
TERMINAL = "ghostty";
};
@@ -9,7 +9,7 @@
nixGL.defaultWrapper = "mesa";
nixGL.installScripts = [ "mesa" ];
programs.ghostty = lib.mkIf (config.enableShell && config.graphical) {
programs.ghostty = lib.mkIf (config.enableShell && config.graphical.ghostty) {
enable = true;
enableZshIntegration = true;
package = config.lib.nixGL.wrap pkgs.ghostty;
@@ -52,7 +52,7 @@
};
# https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970
xdg.desktopEntries."com.mitchellh.ghostty" = lib.mkIf (config.enableShell && config.graphical) {
xdg.desktopEntries."com.mitchellh.ghostty" = lib.mkIf (config.enableShell && config.graphical.ghostty) {
name = "Ghostty";
type = "Application";
comment = "A terminal emulator";

View File

@@ -38,7 +38,9 @@
};
shellAliases.ls = "${pkgs.eza}/bin/eza -lgos type --no-time";
initContent = lib.mkIf config._1password ''
source ${config.home.homeDirectory}/.config/op/plugins.sh
if [ -f "${config.home.homeDirectory}/.config/op/plugins.sh" ]; then
source ${config.home.homeDirectory}/.config/op/plugins.sh
fi
'';
};
}

View File

@@ -0,0 +1,24 @@
{ inputs, config, pkgs, lib, ... }:
let
sopsConfigPath = "${config.home.homeDirectory}/.config/home-manager/jsl-home/.sops.yaml";
sopsSecretsPath = "${config.home.homeDirectory}/.config/home-manager/jsl-home/keys/secrets.yaml";
in
{
imports = [
inputs.sops-nix.homeManagerModules.sops
];
sops = {
# It's also possible to use a ssh key, but only when it has no password:
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
defaultSopsFile = ../keys/secrets.yaml;
defaultSopsFormat = "yaml";
};
home.packages = with pkgs; [
(writeShellScriptBin "edit-secrets" ''
sops --config ${sopsConfigPath} ${sopsSecretsPath}
'')
sops
age
];
programs.zsh.shellAliases.sops = lib.mkIf config.enableShell "sops --config ${sopsConfigPath}";
}

View File

@@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
{
programs.vscode = lib.mkIf config.graphical {
programs.vscode = lib.mkIf config.graphical.vscode {
enable = true;
package = pkgs.vscode;
profiles.default.extensions = with pkgs.vscode-extensions; [

34
keys/secrets.yaml Normal file
View File

@@ -0,0 +1,34 @@
hello: ENC[AES256_GCM,data:4uC3/Tig8jP77fzue3w/gevs7yj61h3hF8bEMLPBlJakpna3G8DVAFOlyqEjOg==,iv:3LCkLVdAdMdo9cD/1usIYu/akZ5anpMlqciHrVcwOLU=,tag:sOSoPPxoippFJAusbtIuVQ==,type:str]
example_key: ENC[AES256_GCM,data:cLLYEiJbKg60ANK/h+kG,iv:1yrJt5JhbDP/9/Wb2l93fjwQF1hxERnxjPZ6qF4S/Bw=,tag:wbboaGylFJRSj4/TB+RCZg==,type:str]
#ENC[AES256_GCM,data:c0Ay18GCW/gowNHmF67TMg==,iv:T+FN8xaVilVSETMQztl6lmpLqnGiyrXhJvWsO+dBdd0=,tag:1D6TkngB116dOeCAX85djg==,type:comment]
example_array:
- ENC[AES256_GCM,data:yUJ7p5VfyQUANjbuz48=,iv:XTGb97tMV3mkPwNyKetSflLLlE31g9UgMPcelMPpNZ0=,tag:j5muB72Ogc/gtenvsWvpbQ==,type:str]
- ENC[AES256_GCM,data:8eQ2clCNBxPfdycPMOo=,iv:C9iT+wJH9ENJShNYo3IGceRwHyrlU6LUE7jpc+72KOw=,tag:YTbZqYJVMUoTRqD2ujTOvg==,type:str]
example_number: ENC[AES256_GCM,data:LhABh/RtBsdKAg==,iv:JGYFnixDNZUIRKJcuaenvO8D60T+Jvx/R7SWxbIPXsM=,tag:+1b/aj3x1yfQZ2j4OM5dcg==,type:float]
example_booleans:
- ENC[AES256_GCM,data:pGnelw==,iv:KAayJZ8px4Qupv0NfapSQ6valrVKndEtCb3U4MTmK/U=,tag:lkl+zBgkEMbFQjNssxYQjg==,type:bool]
- ENC[AES256_GCM,data:Vqqfp2w=,iv:SC1DS7G9/lHYtA6PPRbVsi/ZhyNUYvRjXxHIqCxqEPA=,tag:9hv6F1rP7xSd08KCKkuiLQ==,type:bool]
sops:
age:
- recipient: age1f6drjusg866yscj8029tk4yfpgecklrvezldm02ankm6h8nnwu5s2u6ahy
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBoWkxDSnlNT2Vua1ZXWC8r
SU9UMnhaVXVEVlZGL3dtYTBJSzNGbHVaSTJNCm9ZTFM3RndpRktUcWhwZk1Fc2dk
ZGtoWXdoOWVyK1F0YStSS3dsMkg2R28KLS0tIFkrdVFZNlVxRjhPaWdMZXl2elV3
TVpyTzFsNFNmd3FNU0tlMnlTOHNTQWsKfKdN4epZokF74bCNr9+jxulZJFBQM83P
quMhl+H85My8jAsEeC9CW7y2jdNPJkfk9gHun4ozoW8U7o6y5RLfJg==
-----END AGE ENCRYPTED FILE-----
- recipient: age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBSakZRUnkraWtId2h3eUhB
REpkUHhYMm1MSmtFU2pvd1BpQ0xRTTlCWkZJCkxrTm1sdDBqclJ3RHR6VkllOFpo
ZXRtS2lsazRDS2lyRnZmT3FTTjJ6WUUKLS0tIExxNlFoeDhHQ3l5a1VvUHNRWUdw
Mms2UEhFSU82UWR5Z1VvU25qenJUQm8KtQeZDIfJIczm1l8ql/WmVEf8KI9dg0vw
9rNSjtBkEttVd21zUSOziG4513abllE8NFTkAc1z3HacuXpHTBnd5A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2025-07-07T06:14:57Z"
mac: ENC[AES256_GCM,data:gqadQL2Qp31+3ATZa0r4LDVNv8txUBoRsj3nZnBdLXkyMXKUQD9kuPOS1j+/vF5bg1d6rVdQAWl8BKlcu7UyyhO95P3G4l7hxdNBQCuNbiyb0hxrR2G7O1ZpMGuKec7+cBRkpGtVMrPmvt/7Ymh27qXiV9Gx6j812iSlORolj3w=,iv:Fg23U8c5IRWLdy2KmLHK3O+O9P1P58JF1jqzKnM4wLY=,tag:n6mBBzxQ/hjh5yREwyVGkg==,type:str]
unencrypted_suffix: _unencrypted
version: 3.10.2

View File

@@ -60,15 +60,19 @@
description = "Whether to enable docker stuff";
};
options.graphical = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether this system has a graphical environment";
};
options.steam = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether this system has Steam installed";
};
options.graphical =
let
boolOption = lib.mkOption {
type = lib.types.bool;
default = false;
};
in
{
discord = boolOption;
ghostty = boolOption;
joplin = boolOption;
steam = boolOption;
sublime = boolOption;
vscode = boolOption;
};
}

View File

@@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }:
{
programs.steam = lib.mkIf config.steam {
programs.steam = lib.mkIf config.graphical.steam {
enable = true;
gamescopeSession.enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play