mirror of
https://github.com/Jokiller230/puzzlevision.git
synced 2025-09-09 20:30:05 +00:00
Compare commits
3 commits
6dc0e02a92
...
87c59890d5
Author | SHA1 | Date | |
---|---|---|---|
87c59890d5 | |||
65f710a179 | |||
d7a1a9ffbd |
12 changed files with 110 additions and 18 deletions
17
.sops.yaml
17
.sops.yaml
|
@ -2,19 +2,30 @@ keys:
|
|||
- &jo age1qcjcwh9tq8pzf2yr7m3hm2n3n3y5rlc30fpkr0eytju9w57ucgcsgcy79d
|
||||
- &absolutesolver age1ajkq0lalyc75tjhdtpx2yshw5y3wt85fwjy24luf69rvpavg33vqw6c3tc
|
||||
creation_rules:
|
||||
- path_regex: secrets/[^/]+\.(yaml|json|env|ini|cfg)$
|
||||
- path_regex: secrets/[^/]+\.(yaml|json|env|cfg)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *jo
|
||||
- *absolutesolver
|
||||
|
||||
- path_regex: systems/[^/]+/absolutesolver/secrets/.*\.(yaml|env|json|ini|cfg)$
|
||||
- path_regex: systems/[^/]+/absolutesolver/secrets/.*\.(yaml|env|json|cfg)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *jo
|
||||
- *absolutesolver
|
||||
|
||||
- path_regex: systems/[^/]+/puzzlevision/secrets/.*\.(yaml|env|json|ini|cfg)$
|
||||
- path_regex: systems/[^/]+/puzzlevision/secrets/.*\.(yaml|env|json|cfg)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *jo
|
||||
|
||||
- path_regex: homes/[^/]+/jo/secrets/.*\.(yaml|env|json|cfg)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *jo
|
||||
|
||||
- path_regex: homes/[^/]+/cyn/secrets/.*\.(yaml|env|json|cfg)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *jo
|
||||
- *absolutesolver
|
||||
|
|
10
README.md
10
README.md
|
@ -50,6 +50,16 @@ Additionally, the following command may be used to create a new sops secret file
|
|||
nix-shell -p sops --run "sops secrets/example.yaml"
|
||||
```
|
||||
|
||||
You may also encrypt arbitrary binary formats, like .cfg, using the following command:
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The original file location also HAS to match one of the sops creation rules, not just the output.
|
||||
> Yes, I know this is stupid, and yes, I've wasted way too much time dealing with this :3
|
||||
|
||||
```sh
|
||||
nix-shell -p sops --run "sops -e original_file.cfg > secrets/encrypted_file.cfg"
|
||||
```
|
||||
|
||||
Lastly, when adding new systems, make sure to update any required secret files with the following command:
|
||||
|
||||
```sh
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
{pkgs, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
puzzlevision = {
|
||||
themes.catppuccin.enable = true;
|
||||
};
|
||||
|
||||
sops.secrets.wakatime-cfg = {
|
||||
format = "binary";
|
||||
sopsFile = ./secrets/wakatime.cfg;
|
||||
path = "${config.home.homeDirectory}/.wakatime.cfg";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
## GENERAL
|
||||
youtube-music
|
||||
|
|
19
homes/x86_64-linux/jo/secrets/wakatime.cfg
Normal file
19
homes/x86_64-linux/jo/secrets/wakatime.cfg
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"data": "ENC[AES256_GCM,data:NaNu0ytz8Ji7WJ4gDinY2Tsny+MzgG9vV/7xnZY/dQzB0jMHBxIRAcrzH1A+aqsANeeZPD0XGXC2qIpYUlMKBcfMxkqmlj7XnpvDiXQ9RciCNp8l1xs0wvoxjYghbD8nsL57UQ==,iv:qa1SPnWCShIiz7l4EW6tCT2gJO0qNNcDk05F5hS8H7U=,tag:zArwz8R3/uegsO1ShLjfwg==,type:str]",
|
||||
"sops": {
|
||||
"age": [
|
||||
{
|
||||
"recipient": "age1qcjcwh9tq8pzf2yr7m3hm2n3n3y5rlc30fpkr0eytju9w57ucgcsgcy79d",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBJS0EySk4wMGVzaUtOZWlN\nUE15SXNVOUtqUDQxV29tNGpBRkdLek5icWg0Cnd5b1FmT3VQTTBDdEtCYzQxNVdk\nWVpQMFpmTXpOcFFlMG5MQjFLTXZRUGsKLS0tIHBvakR1Q0dYdkRqVTJtLzRORzBP\nNU55UEtWUXhBdGN0M0lMQktaVmhSK00KA93LFut6jiYtlndm9Oq0ferFPT4IlBQ1\nDmnD4hWz7NLimWED7RiJ2lSO9IRgQBhLHeiLums/ZPxjFGnnO6sicg==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
},
|
||||
{
|
||||
"recipient": "age1ajkq0lalyc75tjhdtpx2yshw5y3wt85fwjy24luf69rvpavg33vqw6c3tc",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBSTHh4eExqN1lmUWhOd0tF\ndzVUYXpWblVlem5QcndUQVRRSnZsS0dNK3lVCnpJQUVyRDRiNTFyb3RnSFZnQW9D\nV2sxRlZDcE1yQjI5Yzk3Tmh2ZkdxZ00KLS0tIGlKYUVnZXZtYTJPNEhEVEVhVlI4\na1hGbjJ3VDE0WDZKd0FGYUZzZUp5SEkKp043TYYglP+SWD7IdK/rnSJ4jfqvpGSY\njIDWMZmFTIcPoeVSQrxi7PD9Cd4Q56lhPhCYZR4czk5EdeIEWS9Z6w==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
}
|
||||
],
|
||||
"lastmodified": "2025-05-21T22:54:54Z",
|
||||
"mac": "ENC[AES256_GCM,data:vYmgUvgyQ1i+gih/6YMWX1vqkWzcAn8zgNspICF6KxTYE08i61LGJSaM2R5rh2r/xWY9zKYv8EKH2GSVyJ+hGgSsS0qY8BOKetKMHZEWuWtWSbjO/iKPlmqZXxmPPiPlYUXjlfXB1rzi7RXwDzwVpD1nQTuiK8t2rYJjGgH0kRM=,iv:EEepXDQ/1zy1sO8eXl5LXTHI5OUPFca6WwuYTkHuyEs=,tag:MHA262l7qa8Ngy0tuggPpw==,type:str]",
|
||||
"unencrypted_suffix": "_unencrypted",
|
||||
"version": "3.10.2"
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
imports = [
|
||||
# Exposes nixosModules and homeModules on flake outputs.
|
||||
./modules.nix
|
||||
|
||||
# Automagically imports libs from "/lib/lib-name" and exposes them to the `flake.lib` output.
|
||||
./lib.nix
|
||||
|
||||
# Exposes nixosModules and homeModules on flake outputs.
|
||||
./modules.nix
|
||||
|
||||
# Automagically imports systems from "/systems/arch-classname/system-name".
|
||||
./systems.nix
|
||||
];
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
pkgs,
|
||||
self,
|
||||
config,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
@ -16,12 +15,6 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
sops.secrets.wakatime-cfg = {
|
||||
format = "binary";
|
||||
sopsFile = "${self.outPath}/x86_64-nixos/${osConfig.networking.hostname}/secrets/wakatime.cfg";
|
||||
path = "/home/${config.home.homeDirectory}/.wakatime.cfg";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
alejandra
|
||||
];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{config, ...}: {
|
||||
sops = {
|
||||
age.keyFile = "/home/${config.home.username}/.sops-nix/key.txt";
|
||||
age.keyFile = "/home/${config.home.username}/sops-nix/key.txt";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,11 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.sessionVariables = {
|
||||
MOZ_ENABLE_WAYLAND = "1"; # Firefox native Wayland support
|
||||
NIXOS_OZONE_WL = "1"; # Native Wayland in Chromium and Electron based applications
|
||||
};
|
||||
|
||||
${namespace} = {
|
||||
# Basic system functionality
|
||||
system = {
|
||||
|
|
|
@ -38,6 +38,8 @@ in {
|
|||
package = mkIf cfg.use-lix pkgs.lix; # Enable LIX
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Dynamic libraries for unpackaged programs
|
||||
programs.nix-ld = mkIf cfg.use-nixld {
|
||||
enable = true;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
isSystemUser = self.lib.mkBool false "Whether this user is considered a system user.";
|
||||
initialPassword = self.lib.mkOpt (types.nullOr types.str) null "Plaintext insecure initial user password, only recommended for testing.";
|
||||
password = self.lib.mkOpt (types.nullOr types.str) null "Plaintext insecure user password, only recommended for testing.";
|
||||
hashedPasswordFile = self.lib.mkOpt (types.nullOr types.str) null "Secure, hashed user password stored in a separate file, recommended for production.";
|
||||
extraGroups = self.lib.mkOpt (types.listOf types.str) [] "List of additional groups this user belongs to.";
|
||||
};
|
||||
};
|
||||
|
@ -48,7 +49,7 @@ in {
|
|||
users.users = lib.mapAttrs (username: userConfig:
|
||||
mkIf userConfig.enable {
|
||||
name = username;
|
||||
inherit (userConfig) isNormalUser isSystemUser initialPassword password extraGroups;
|
||||
inherit (userConfig) isNormalUser isSystemUser initialPassword hashedPasswordFile password extraGroups;
|
||||
})
|
||||
cfg;
|
||||
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
{pkgs, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./hardware.nix
|
||||
];
|
||||
|
||||
# Todo: automate this globally for all workstation and server archetypes!
|
||||
# Configure Sops
|
||||
sops.defaultSopsFile = ./secrets/users.yaml;
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
|
||||
# Todo: automate this import in users module!
|
||||
# Require user password secrets for users
|
||||
sops.secrets."users/jo/password_hash".neededForUsers = true;
|
||||
|
||||
puzzlevision = {
|
||||
users.jo = {
|
||||
enable = true;
|
||||
password = "jo"; # For testing only, replace with sops secret before production use
|
||||
#password = "4868320069443";
|
||||
hashedPasswordFile = config.sops.secrets."users/jo/password_hash".path; # For testing only, replace with sops secret before production use
|
||||
extraGroups = ["wheel"];
|
||||
};
|
||||
|
||||
|
|
27
systems/x86_64-nixos/puzzlevision/secrets/users.yaml
Normal file
27
systems/x86_64-nixos/puzzlevision/secrets/users.yaml
Normal file
|
@ -0,0 +1,27 @@
|
|||
users:
|
||||
jo:
|
||||
password_hash: ENC[AES256_GCM,data:fdHmZC03D7X5Z8/ghp/lAv61+TSTr8i3gpBuwZq94JFsJHoaMwTiE2IqHWg/HtcDfynZTsVKbepORXbUPxL02JaRYHJNNkRg8cMIu9ZMs2b2DqypGKq4gKXEUn0QyuN0G3m9Hw2F8B6GRg==,iv:d2ELe9iQR0c9jnoK/nhzXs7p7Kr2kkqQVUXrUlwIQjY=,tag:7DQ/zTbFPr1tsE4k79Fq7w==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- recipient: age1qcjcwh9tq8pzf2yr7m3hm2n3n3y5rlc30fpkr0eytju9w57ucgcsgcy79d
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAvSEdxL2pyZHRiVlFqOE1i
|
||||
MWpScjRSdEJJZjRmQ0dsRTBYSlFsSncyd1FnCjNDWEI1cHNuVGd4dEJDMXF2NnlI
|
||||
SFA3NFU3SkpGLzZMNjZtc1JHajhEeXMKLS0tIGhaSDVqSGxaZEwrdFZ6ZDF6a0cw
|
||||
ZmluTzlkNGFSTmZLNlVYdFBOWTQ2cDgKJL4o95JLEKFI3FUQ2+g4N0GWGohRtmW7
|
||||
fn7zxQhRFf8U9yE4gI3OBTEweoyJQh+m/JH6XCg7H5jrJjze5miSUQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1ajkq0lalyc75tjhdtpx2yshw5y3wt85fwjy24luf69rvpavg33vqw6c3tc
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBjdkFCaFZkZjJuc0dHdE03
|
||||
Z2N5ZnZrMnFIQ0R5U2NqMjFoWWZSNUl5Mm1FCmxIMDFNSGtOamhtZDJjdi82Ty9h
|
||||
VU0xN1pza2VpSDA1N01oN3FTUHNxcGcKLS0tIFZhVWFuQ1VXS2dyUEF6NHliNW9I
|
||||
N21SUVFML3Z3Y3FMV3RiV2pGOUJMd00KyoA9/4gSxQTIInRsiF0gdOqYHoI8s2cG
|
||||
DozFpSRzkrev6sSxEDJC8N/BmpVm2v8Wzpg572i1trEBQIjZMqqhJA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2025-05-22T00:25:40Z"
|
||||
mac: ENC[AES256_GCM,data:5oMgqzkL1+VIAnC28q5CH4Y5Po/B5zg2v3kJAlid71K2CKN2s0xrygTmgHYQ0QlO/BJR5kF1HrBVloAq81jTSDyF7XfrdvBzG4Iqs/kmvMC1ln4khf0ZxaH5Q3caGJSmAH6nXMPOglAwFQEm9BXNuknocuQwUEzB6rijQ3F+yXw=,iv:GGleCn9EX76JcSqzPdZOnDzbfYla1eGQY/srHnZdBVk=,tag:09eZjhMYV0RIUqShsJfN0w==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.10.2
|
Loading…
Add table
Add a link
Reference in a new issue