diff --git a/configuration.nix b/configuration.nix index 96a56c1..ed6d978 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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 ]; }; diff --git a/flake.nix b/flake.nix index 246ae90..e7fe647 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/home-manager/global/default.nix b/home-manager/global/default.nix index 25787cb..ac578de 100644 --- a/home-manager/global/default.nix +++ b/home-manager/global/default.nix @@ -2,7 +2,7 @@ { imports = [ - ./beets.nix + # ./beets.nix ./keybase.nix "${inputs.vscode-server}/modules/vscode-server/home.nix" ] ++ (builtins.attrValues outputs.homeManagerModules); diff --git a/home-manager/global/keybase.nix b/home-manager/global/keybase.nix index db35a88..f0c0b50 100644 --- a/home-manager/global/keybase.nix +++ b/home-manager/global/keybase.nix @@ -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 { diff --git a/hosts/StuPC/default.nix b/hosts/StuPC_WSL/default.nix similarity index 97% rename from hosts/StuPC/default.nix rename to hosts/StuPC_WSL/default.nix index d3724ce..f5f4bde 100644 --- a/hosts/StuPC/default.nix +++ b/hosts/StuPC_WSL/default.nix @@ -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; diff --git a/hosts/syncthing.nix b/hosts/syncthing.nix index 7d494c2..1265faa 100644 --- a/hosts/syncthing.nix +++ b/hosts/syncthing.nix @@ -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"; diff --git a/mods-old/gnome/default.nix b/mods-old/gnome/default.nix deleted file mode 100644 index 9b5fc92..0000000 --- a/mods-old/gnome/default.nix +++ /dev/null @@ -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 ]; - - }; -} diff --git a/mods-old/homemanager_hyperv.nix b/mods-old/homemanager_hyperv.nix deleted file mode 100644 index ca6f1c8..0000000 --- a/mods-old/homemanager_hyperv.nix +++ /dev/null @@ -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"; }; - - }; - } \ No newline at end of file diff --git a/modules/home-manager/beets/default.nix b/modules/home-manager/beets/default.nix new file mode 100644 index 0000000..ea37c96 --- /dev/null +++ b/modules/home-manager/beets/default.nix @@ -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 claypool’s duo de twang","oysterhead","colonel claypool’s 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"; + }; + }; + + }; +}; +} + diff --git a/modules/home-manager/ssh-proxy/default.nix b/modules/home-manager/ssh-proxy/default.nix index 98885ce..cf82fe2 100644 --- a/modules/home-manager/ssh-proxy/default.nix +++ b/modules/home-manager/ssh-proxy/default.nix @@ -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" ]; }; + }; }; diff --git a/modules/nixos/vpn/default.nix b/modules/nixos/vpn/default.nix index 92b81d5..a59d5d1 100644 --- a/modules/nixos/vpn/default.nix +++ b/modules/nixos/vpn/default.nix @@ -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"; }; diff --git a/secrets/hosts/StuPC/mullvad/device.json b/secrets/hosts/StuPC_WSL/mullvad/device.json similarity index 100% rename from secrets/hosts/StuPC/mullvad/device.json rename to secrets/hosts/StuPC_WSL/mullvad/device.json diff --git a/secrets/hosts/StuPC_WSL/syncthing/cert.pem b/secrets/hosts/StuPC_WSL/syncthing/cert.pem new file mode 100644 index 0000000..beb2b02 --- /dev/null +++ b/secrets/hosts/StuPC_WSL/syncthing/cert.pem @@ -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----- diff --git a/secrets/user_dotfiles/sstent@StuPC/keybase/autostart_created b/secrets/user_dotfiles/sstent@StuPC_WSL/keybase/autostart_created similarity index 100% rename from secrets/user_dotfiles/sstent@StuPC/keybase/autostart_created rename to secrets/user_dotfiles/sstent@StuPC_WSL/keybase/autostart_created diff --git a/secrets/user_dotfiles/sstent@StuPC/keybase/config.json b/secrets/user_dotfiles/sstent@StuPC_WSL/keybase/config.json similarity index 100% rename from secrets/user_dotfiles/sstent@StuPC/keybase/config.json rename to secrets/user_dotfiles/sstent@StuPC_WSL/keybase/config.json diff --git a/secrets/user_dotfiles/sstent@StuPC/keybase/device_clone.json b/secrets/user_dotfiles/sstent@StuPC_WSL/keybase/device_clone.json similarity index 100% rename from secrets/user_dotfiles/sstent@StuPC/keybase/device_clone.json rename to secrets/user_dotfiles/sstent@StuPC_WSL/keybase/device_clone.json diff --git a/secrets/user_dotfiles/sstent@StuPC/keybase/gui_config.json b/secrets/user_dotfiles/sstent@StuPC_WSL/keybase/gui_config.json similarity index 100% rename from secrets/user_dotfiles/sstent@StuPC/keybase/gui_config.json rename to secrets/user_dotfiles/sstent@StuPC_WSL/keybase/gui_config.json diff --git a/secrets/user_dotfiles/sstent@StuPC/keybase/secretkeys.sstent.mpack b/secrets/user_dotfiles/sstent@StuPC_WSL/keybase/secretkeys.sstent.mpack similarity index 100% rename from secrets/user_dotfiles/sstent@StuPC/keybase/secretkeys.sstent.mpack rename to secrets/user_dotfiles/sstent@StuPC_WSL/keybase/secretkeys.sstent.mpack