This commit is contained in:
2023-03-08 18:00:18 +00:00
parent 56e5cde883
commit 9c82720103
18 changed files with 213 additions and 159 deletions

View File

@@ -100,10 +100,10 @@ in
./hosts/WSL/Go3
];
};
StuPC = nixpkgs.lib.nixosSystem {
StuPC_WSL = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./hosts/WSL/StuPC
./hosts/WSL/StuPC_WSL
];
};

View File

@@ -117,10 +117,10 @@
./hosts/Go3
];
};
StuPC = nixpkgs.lib.nixosSystem {
StuPC_WSL = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib; hostName = "StuPC";};
modules = [
./hosts/StuPC
./hosts/StuPC_WSL
];
};
@@ -140,10 +140,10 @@
inputs.sops-nix.homeManagerModules.sops
];
};
"sstent@StuPC" = home-manager.lib.homeManagerConfiguration {
"sstent@StuPC_WSL" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "StuPC";};
extraSpecialArgs = { inherit inputs outputs lib; hostName = "StuPC_WSL";};
modules = [
# > Our main home-manager configuration file <
./home-manager/users/sstent

View File

@@ -2,7 +2,7 @@
{
imports = [
./beets.nix
# ./beets.nix
./keybase.nix
"${inputs.vscode-server}/modules/vscode-server/home.nix"
] ++ (builtins.attrValues outputs.homeManagerModules);

View File

@@ -1,10 +1,13 @@
{ config, pkgs, inputs, lib, hostName, util, ... }:
{ config, pkgs, inputs, lib, util, hostName, ... }:
with lib;
with lib.my;
let
cfg = config.custom.keybase;
username = config.home.username;
secretstore = config._secretstore;
# host = config.networking.hostName;
in {

View File

@@ -9,7 +9,7 @@
# system.stateVersion = "22.11";
nixpkgs.hostPlatform.system = "x86_64-linux";
networking.hostName = "StuPC";
networking.hostName = "StuPC_WSL";
custom.mullvad.enable = true;
wsl = {
enable = true;

View File

@@ -1,9 +1,21 @@
{ lib, inputs, outputs, ... }:
{
{ inputs, lib, config, pkgs, ... }:
let
# cfg = config.modules.services.syncthing;
host = config.networking.hostName;
# Device IDs don't really need to be secret, but according to syncthing docs
# one can get the device IP if they know the device ID.
# devices = import ../../secrets/syncthing-devices.nix;
# FFS!! path concatenation in nix is a pain in the ass! see
# https://gist.github.com/CMCDragonkai/de84aece83f8521d087416fa21e34df4
# cert-text = builtins.readFile ("${config._secretstore}/hosts/" + "/${host}" + /syncthing/cert.pem);
# key-text = builtins.readFile ("${config._secretstore}/hosts/" + "/${host}" + /syncthing/key.pem);
in {
services.syncthing = {
enable = true;
dataDir = "/home/sstent";
# cert = "${pkgs.writeText "syncthing-cert.pem" cert-text}";
# key = "${pkgs.writeText "syncthing-key.pem" key-text}";
openDefaultPorts = true;
configDir = "/home/sstent/.config/syncthing";
user = "sstent";

View File

@@ -1,68 +0,0 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ lib, config, pkgs, ... }: {
#define option to enable this
options.mymods.gnome.enable = lib.mkEnableOption "Enable Gnome Env";
config = lib.mkIf config.mymods.gnome.enable {
users.users.gdm.extraGroups = [ "video" ];
services.xserver = {
enable = true;
modules = [ pkgs.xorg.xf86videofbdev ];
videoDrivers = [ "hyperv_fb" ];
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
displayManager.startx.enable = true;
};
environment.gnome.excludePackages = (with pkgs; [ gnome-photos gnome-tour ])
++ (with pkgs.gnome; [
cheese # webcam tool
gnome-music
#gnome-terminal
#gedit # text editor
epiphany # web browser
geary # email reader
#evince # document viewer
gnome-characters
totem # video player
tali # poker game
iagno # go game
hitori # sudoku game
atomix # puzzle game
]);
## https://github.com/NixOS/nixpkgs/issues/126265
## watch https://github.com/NixOS/nixpkgs/pull/83928
services.xrdp = {
# enable = true;
# defaultWindowManager = "${pkgs.gnome3.gnome-shell}/bin/gnome-shell";
package = pkgs.xrdp.overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [ "--enable-vsock" ];
postInstall = oldAttrs.postInstall + ''
substituteInPlace $out/etc/xrdp/xrdp.ini \
--replace "port=3389" "port=vsock://-1:3389" \
--replace "security_layer=negotiate" "security_layer=rdp" \
--replace "crypt_level=high" "crypt_level=none" \
--replace "bitmap_compression=true" "bitmap_compression=false"
substituteInPlace $out/etc/xrdp/sesman.ini \
--replace "X11DisplayOffset=10" "X11DisplayOffset=0" \
--replace "FuseMountName=thinclient_drives" "FuseMountName=shared_drives"
'';
});
};
# --replace "use_vsock=false" "use_vsock=true" \
environment.etc."X11/Xwrapper.config".text = ''
allowed_users=anybody
'';
services.xrdp.enable = true;
services.xrdp.defaultWindowManager = "gnome-shell";
networking.firewall.allowedTCPPorts = [ 3389 ];
};
}

View File

@@ -1,76 +0,0 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "sstent";
home.homeDirectory = "/home/sstent";
#targets.genericLinux.enable = true;
# changes in each release.
# home.stateVersion = "22.05";
home.stateVersion = "23.05";
home.shellAliases = {
revert_base_config = "sudo cp /etc/nixos/{orig_,}configuration.nix; sudo cp /etc/nixos/{orig_,}flake.nix; sudo cp /etc/nixos/{orig_,}homemanager.nix; sudo nixos-generate-config";
};
# Let Home Manager install and manage itself.
# programs.home-manager.enable = true;
home.packages = with pkgs; [
nicotine-plus
gnomeExtensions.mullvad-indicator
mullvad-vpn
];
programs.bash.enable = true;
programs.firefox.enable = true;
programs.gnome-terminal.enable = true;
programs.gnome-terminal.profile = {
"f2afd3c7-cb35-4d08-b6c2-523b444be64d" = {
visibleName = "Stu";
showScrollbar = true;
default = true;
font = "DejaVu Sans Mono 12";
colors = {
backgroundColor = "rgb(23,20,33)";
foregroundColor = "rgb(208,207,204)";
palette = [
"#272224"
"#FF473D"
"#3DCCB2"
"#FF9600"
"#3B7ECB"
"#F74C6D"
"#00B5FC"
"#3E3E3E"
"#52494C"
"#FF6961"
"#85E6D4"
"#FFB347"
"#779ECB"
"#F7A8B8"
"#55CDFC"
"#EEEEEC"
];
};
};
};
xdg.configFile."nicotine/config.old".source = ./configs/nicotine;
xdg.configFile."gnome-initial-setup-done".text = "yes";
xdg.configFile."gtk-3.0/bookmarks".text = ''
file:///mnt/Public Public
'';
dconf.settings = {
# ...
"org/gnome/shell" = {
favorite-apps = [
"firefox.desktop"
"org.gnome.Terminal.desktop"
"org.gnome.Nautilus.desktop"
];
};
"org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; };
};
}

View File

@@ -0,0 +1,166 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.custom.beets;
in {
options.custom.beets = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Beets";
};
};
config = mkIf cfg.enable {
# xdg.configFile."beets/config.old".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test;
programs.beets = {
enable = true;
settings = {
album_fields = {
artist_grouping = ''
albumartist_dev = ["devin townsend", "devin townsend project","punky brüster","strapping young lad"]
DevinFolder = "_Devin Townsend Projects"
if albumartist.lower() in albumartist_dev:
return DevinFolder
albumartist_les = ["primus", "les claypool","les claypool and the holy mackerel","les claypools duo de twang","oysterhead","colonel claypools bucket of bernie brains","the les claypool frog brigade","the claypool lennon delirium"]
LesFolder = "_Les Claypool Projects"
if albumartist.lower() in albumartist_les:
return LesFolder
'';
atype = ''
atypes = ['EP', 'Single','Live']
for atype in atypes:
if atype.lower() == albumtype.lower():
return f' [{atype}]'
'';
first_artist = "albumartist.split(', ',1)[0:1][0]";
};
albumtypes = {
bracket = "[]";
ignore_va = "compilation";
types = [
{ ep = "EP"; }
{ single = "Single"; }
{ soundtrack = "OST"; }
{ live = "Live"; }
{ compilation = "Anthology"; }
{ remix = "Remix"; }
];
};
aunique = {
bracket = "[]";
disambiguators = "media";
keys = "albumartist album";
};
copyartifacts = { extensions = ".cue .log .jpg .jpeg .png .txt"; };
directory = "/mnt/q/CleanMusic/";
embedart = { auto = true; };
extrafiles = {
paths = {
artworkdir = "$albumpath/Artwork";
"ext:cue" = "$albumpath/$disc_folder/Data/";
"ext:jpg" = "$albumpath/$disc_folder/";
"ext:log" = "$albumpath/$disc_folder/Data/";
};
patterns = {
all = "*.*";
artworkdir = [ "[sS]cans/" "[aA]rtwork/" "[aA]rt/" "[cC]over/" ];
};
};
fetchart = {
auto = true;
sources = "filesystem coverart itunes amazon albumart fanarttv";
};
import = {
autotag = true;
bell = false;
copy = true;
languages = "en";
log = "~/.config/beets/beet.log";
move = false;
write = true;
};
item_fields = {
isMultidisc = "1 if disctotal > 1 else 0";
myBitDepth = "('' if bitdepth != 24 else '[24bit - '+ media + ']')";
myDisc = "('' if disctotal <= 1 else str(disc) + ' - ')";
mySongartist =
"artist + ' - ' if artist != albumartist and artist != '' else ''";
};
library = "~/musiclibrary.db";
match = {
max_rec = {
album = "strong";
album_id = "strong";
albumdisambig = "strong";
artist = "strong";
catalognum = "strong";
country = "strong";
label = "strong";
media = "strong";
mediums = "strong";
missing_tracks = "medium";
source = "strong";
track_artist = "strong";
track_id = "strong";
track_index = "strong";
track_length = "strong";
track_title = "strong";
tracks = "strong";
unmatched_tracks = "medium";
year = "strong";
};
strong_rec_thresh = 5.0e-2;
};
missing = {
format_album = "$albumartist: ($year) $album $albumtype $atype";
format_item =
"$albumartist - $album [$albumtype]$atype: $track/$tracktotal $title";
};
musicbrainz = {
pass = "7ANCLPczDNFn6Sf65vdZ";
user = "shapechecker";
};
original_date = true;
paths = {
"albumtype:soundtrack" =
"Soundtracks/$albumartist - $album%aunique{} ($year)/$myDisc$track - $artist - $title";
comp =
"Compilations/$albumartist/($year) $album%aunique{}/$myDisc$track - $artist - $title";
default =
"%if{$artist_grouping,$artist_grouping/}$first_artist/$year - $album $atype%aunique{media}[%upper{$format}$bitdepth]%if{$media,[$media]}/%if{$isMultidisc,$disc - }$track - $mySongartist$title";
};
per_disc_numbering = true;
plugins = [
"albumtypes"
"duplicates"
"fetchart"
"rewrite"
"missing"
"chroma"
"embedart"
"inline"
"discogs"
"mbcollection"
];
rewrite = {
"artist Björk & Tríó Guðmundar Ingólfssonar" = "Björk";
"artist Brant Bjork and The Low Desert Punk Band" = "Brant Bjork";
"artist King Gizzard & The Lizard Wizard with Mild High Club" =
"King Gizzard & The Lizard Wizard";
"artist Kyuss _ Queens of the Stone Age" = "Kyuss";
"artist Professor Elemental & Tom Caruana" = "Professor Elemental";
"artist Resin Dogs Feat Spikey Tee" = "Resin Dogs";
"artist Sepultura _ Exodus" = "Sepultura";
"artist The Knife in collaboration with Mount Sims and Planningtorock" =
"The Knife";
"artist Unida _ Dozer" = "Unida";
};
};
};
};
}

View File

@@ -26,7 +26,8 @@ in {
startServices = true;
services.ssh-proxy = {
Unit = { Description = "WSL Proxy"; After = "network.target";};
Unit = { Description = "WSL Proxy"; After = "sops-nix.service";};
Install = { WantedBy = [ "default.target" ]; };
Service = {
ExecStart = "${pkgs.writeShellScript "start-proxy" ''
set -x -o xtrace # print commands
@@ -34,7 +35,7 @@ ${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock
${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork
''}";
};
#Install = { WantedBy = [ "default.target" ]; };
};
};

View File

@@ -1,9 +1,11 @@
{ lib, pkgs, config, hostName,... }:
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.custom.mullvad;
secretstore = config._secretstore;
host = config.networking.hostName;
in {
@@ -15,7 +17,7 @@ in {
services.mullvad-vpn.enable = true;
sops.secrets.device_json = {
sopsFile = "${secretstore}/hosts/${hostName}/mullvad/device.json";
sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json";
format = "binary";
};

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICHTCCAaOgAwIBAgIJAKIG4c/+/SR+MAoGCCqGSM49BAMCMEoxEjAQBgNVBAoT
CVN5bmN0aGluZzEgMB4GA1UECxMXQXV0b21hdGljYWxseSBHZW5lcmF0ZWQxEjAQ
BgNVBAMTCXN5bmN0aGluZzAeFw0yMzAzMDgwMDAwMDBaFw00MzAzMDMwMDAwMDBa
MEoxEjAQBgNVBAoTCVN5bmN0aGluZzEgMB4GA1UECxMXQXV0b21hdGljYWxseSBH
ZW5lcmF0ZWQxEjAQBgNVBAMTCXN5bmN0aGluZzB2MBAGByqGSM49AgEGBSuBBAAi
A2IABNd7njUzwcxqugMjIRzpvNMqnnsHhU05sPRKLmft+3FKBLNPJhjnbMwCNjaB
SLxZA61g7R6UhQz6A1Ca4btE4d0Sv1+2pZB7uEj3sy1nNcZc/sRfKBUijHj2RTo0
VqL2l6NVMFMwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr
BgEFBQcDAjAMBgNVHRMBAf8EAjAAMBQGA1UdEQQNMAuCCXN5bmN0aGluZzAKBggq
hkjOPQQDAgNoADBlAjAUHGoaFOjc1eAFNUbx5+s10PAaW9NdL9I2DDCDR7x06aQe
ojK4JC+ISo/BM10eFjsCMQDBOWqas67C1Ma4J4GF86qw/IK6/OXnBmUPExEHA4XV
lVbbT9PRn7hggFh5bjSpPQI=
-----END CERTIFICATE-----