diff --git a/hosts/wsl2/default.nix b/hosts/wsl2/default.nix index c6e37b8..05b790b 100644 --- a/hosts/wsl2/default.nix +++ b/hosts/wsl2/default.nix @@ -4,10 +4,10 @@ system.stateVersion = "22.05"; wsl = { enable = true; - automountPath = "/mnt"; + wslConf.automount.root = "/mnt"; defaultUser = "sstent"; startMenuLaunchers = true; - compatibility.interopPreserveArgvZero = true; + interop.preserveArgvZero = true; }; mymods = { diff --git a/modules/beets.nix b/modules/beets.nix new file mode 100644 index 0000000..3f87db2 --- /dev/null +++ b/modules/beets.nix @@ -0,0 +1,151 @@ + +{ config, pkgs, lib, ... }: + +{ + 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 = "~/beet/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/mrconfig b/modules/mrconfig new file mode 100644 index 0000000..183872c --- /dev/null +++ b/modules/mrconfig @@ -0,0 +1,39 @@ + +[projects/ansible-home] +name = ansible-home +checkout = git clone 'keybase://private/sstent/ansible-home' 'ansible-home' +fixups = + if ! git config remote.keybase.url > /dev/null; then + echo "NO KeyBase"… + fi + +[projects/nomad] +name = nomad +checkout = git clone 'keybase://private/sstent/nomad' 'nomad' + + +[projects/containers] +name = containers +checkout = git clone 'git@github.com:sstent/containers.git' "$MR_REPO" +post_checkout = cd "$MR_REPO" && git remote add keybase keybase://private/sstent/containers +fixups = + if ! git config remote.keybase.url > /dev/null; then + echo "No KeyBase" + fi + + +[.config/nixpkgs] +name = nixpkgs +checkout = git clone 'git@github.com:sstent/nixpkgs.git' 'nixpkgs' +fixups = + if ! git config remote.keybase.url > /dev/null; then + echo "No KeyBase" + git remote add keybase keybase://private/sstent/nixpkgs + fi + +[projects/gocast] +name = gocast +checkout = git clone 'git@github.com:sstent/gocast.git' 'gocast' + +[projects/code] +checkout = git clone 'keybase://private/sstent/code' 'code' diff --git a/modules/user.nix b/modules/user.nix index 3b53dfb..6575fe5 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -1,69 +1,118 @@ { lib, config, pkgs, ... }: { -options.mymods.user_sstent.enable = lib.mkEnableOption "Create sstent user"; + options.mymods.user_sstent.enable = lib.mkEnableOption "Create sstent user"; -config = lib.mkIf config.mymods.user_sstent.enable { - users.users = { - sstent = { - initialPassword = "farscape5"; - isNormalUser = true; - openssh.authorizedKeys.keys = [ + config = lib.mkIf config.mymods.user_sstent.enable { + users.users = { + sstent = { + initialPassword = "farscape5"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+D4o3mL4BQsRr0UIhB1hn0brSTIJ9Lr0m2fMMVGF3tIuEihnmwGTeAX78q5/bmoo4gZy7G+CHal54S1lY8LY1KvmIDCpPJ8848HvLbTiTX3qZ7Mjaav+Ox9eHMwX+7zkPwdhfP8TDvmNe12j1GEKBhAm+FhdBQCbEV7cbm1SkX0+WBGoVvI2qbRm1RF0mOuTAmO3Lr2YeAcKJ21YxwNMv1Qrj7oxGYH9rLHLNwZ/0soIdTC9cikl4DHyvCs4HRYcVw36uuCVc/AyIT2GeETRapAQr8nzT89Haa1IThgZ9ztjSsSSOtrUhxatlMIfTIpVjl/gWq7GLfqd/ei/evTal sstent@StuPC" - ]; + ]; extraGroups = [ "wheel" "video" ]; + }; }; + security.sudo.wheelNeedsPassword = false; + + home-manager.users."sstent" = { + home.username = "sstent"; + home.homeDirectory = "/home/sstent"; + #targets.genericLinux.enable = true; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + home.packages = with pkgs; [ + autossh + azure-cli + ansible + sshpass + (import ./python-packages.nix { pkgs = pkgs; }) + pyinfra + sshpass + nmap + nomad_1_4 + consul + terraform + wget + curl + socat + p7zip + #git-run + mr + perl + # beets + qemu_kvm + nixos-generators + nixfmt + deploy-rs + ]; + + services.keybase.enable = true; + services.kbfs.enable = true; +home.file.".mrconfig".source = ./mrconfig; +# xdg.configFile."beets/config.yaml".source = ./beets_config.yaml; +programs = { + dircolors.enable = true; + go.enable = true; + gpg.enable = true; + htop.enable = true; + jq.enable = true; + less.enable = true; + man.enable = true; + nix-index.enable = true; + yt-dlp.enable = true; + bash = { + enable = true; + bashrcExtra = '' + export DOCKER_HOST="tcp://192.168.1.223:2375"; + export NOMAD_ADDR="http://192.168.1.250:4646"; + export TERM="xterm-256color"; + export ANSIBLE_HOST_KEY_CHECKING=False + + export HSTR_CONFIG=hicolor # get more colors + shopt -s histappend # append new history items to .bash_history + export HISTCONTROL=ignorespace # leading space hides commands from history + # ensure synchronization between bash memory and history file + export PROMPT_COMMAND="history -a;" + + if [ -e /home/sstent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/sstent/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer + + #keybase service & + # Configure ssh forwarding + . ~/bin/wsl-ssh-agent-forwarder + ssh-add -l + + ''; + }; + git = { + enable = true; + userName = "sstent"; + userEmail = "stuart.stent@gmail.com"; }; - security.sudo.wheelNeedsPassword = false; - - -home-manager.users."sstent" = { -home.username = "sstent"; - home.homeDirectory = "/home/sstent"; - #targets.genericLinux.enable = true; - - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "22.05"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - home.packages = with pkgs; [ - autossh - azure-cli - ansible - sshpass - (import ./python-packages.nix { pkgs = pkgs; }) - pyinfra - sshpass - nmap - nomad_1_4 - consul - terraform - wget - curl - socat - p7zip - #git-run - mr - perl - # beets - qemu_kvm - nixos-generators - nixfmt - deploy-rs - ]; - - -services.keybase.enable = true; -services.kbfs.enable = true; -# home.file.".mrconfig".source = ./mrconfig; + ssh = { + enable = true; + matchBlocks = { + "odroid*" = { + user = "root"; + }; + }; + }; }; -}; -} \ No newline at end of file +imports = [ + ./beets.nix +]; }; + + }; +}