From 8f204d6f505b75a7fed281c719a49394c527d3d7 Mon Sep 17 00:00:00 2001 From: Bad Date: Tue, 6 Apr 2021 20:59:09 +0200 Subject: [PATCH] Format files --- extern/default.nix | 3 +- flake.nix | 3 +- hosts/teapot.nix | 31 +++++---- hosts/tesco.nix | 46 +++++++++++++ lib/attrs.nix | 4 +- lib/devos/mkHomeConfigurations.nix | 4 +- lib/devos/mkProfileAttrs.nix | 16 ++--- profiles/amd/default.nix | 13 ++++ profiles/core/default.nix | 1 + profiles/develop/default.nix | 12 ++-- profiles/game/default.nix | 4 +- profiles/laptop/default.nix | 2 +- profiles/sway/default.nix | 3 - suites/default.nix | 3 +- tests/lib.nix | 2 +- tests/profiles/t/default.nix | 1 + users/mae/default.nix | 106 +++++++++++++++-------------- users/modules/module-list.nix | 2 +- 18 files changed, 161 insertions(+), 95 deletions(-) create mode 100644 hosts/tesco.nix create mode 100644 profiles/amd/default.nix diff --git a/extern/default.nix b/extern/default.nix index 66f4e78..4ca9df6 100644 --- a/extern/default.nix +++ b/extern/default.nix @@ -25,6 +25,5 @@ ]; # passed to all home-manager modules - userSpecialArgs = { - }; + userSpecialArgs = { }; } diff --git a/flake.nix b/flake.nix index 2af7520..a661529 100644 --- a/flake.nix +++ b/flake.nix @@ -88,7 +88,8 @@ tests = nixos.lib.optionalAttrs (system == "x86_64-linux") (import ./tests { inherit self pkgs; }); deployHosts = nixos.lib.filterAttrs - (n: _: self.nixosConfigurations.${n}.config.nixpkgs.system == system) self.deploy.nodes; + (n: _: self.nixosConfigurations.${n}.config.nixpkgs.system == system) + self.deploy.nodes; deployChecks = deploy.lib.${system}.deployChecks { nodes = deployHosts; }; in nixos.lib.recursiveUpdate tests deployChecks; diff --git a/hosts/teapot.nix b/hosts/teapot.nix index 8f04b41..b708b58 100644 --- a/hosts/teapot.nix +++ b/hosts/teapot.nix @@ -19,38 +19,39 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/75b8df4a-8839-40cd-92ad-dc83007199f4"; + { + device = "/dev/disk/by-uuid/75b8df4a-8839-40cd-92ad-dc83007199f4"; fsType = "btrfs"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/B940-3C52"; + { + device = "/dev/disk/by-uuid/B940-3C52"; fsType = "vfat"; }; swapDevices = - [ { device = "/dev/disk/by-uuid/1b49df34-6db0-487a-9bb1-306ede0245b0"; } - ]; + [{ device = "/dev/disk/by-uuid/1b49df34-6db0-487a-9bb1-306ede0245b0"; }]; boot.kernelParams = [ "intel_pstate=no_hwp" ]; fileSystems."/".options = [ "noatime" "nodiratime" "discard" ]; - + boot.loader.grub = { - enable= true; - version = 2; - device = "nodev"; - efiSupport = true; - enableCryptodisk = true; - gfxmodeEfi = "1024x768"; + enable = true; + version = 2; + device = "nodev"; + efiSupport = true; + enableCryptodisk = true; + gfxmodeEfi = "1024x768"; }; boot.loader.efi.efiSysMountPoint = "/boot"; boot.initrd.luks.devices = { - root = { - device = "/dev/disk/by-uuid/d51c0e1d-7b44-4011-bb8c-8773df2ca890"; - preLVM = true; - }; + root = { + device = "/dev/disk/by-uuid/d51c0e1d-7b44-4011-bb8c-8773df2ca890"; + preLVM = true; + }; }; networking.networkmanager.enable = true; diff --git a/hosts/tesco.nix b/hosts/tesco.nix new file mode 100644 index 0000000..4a2824c --- /dev/null +++ b/hosts/tesco.nix @@ -0,0 +1,46 @@ +{ suites, ... }@inputs: +{ + imports = builtins.trace (builtins.attrNames inputs) (suites.desktop ++ suites.amd); + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "20.09"; # Did you read the comment? + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "tesco"; # Define your hostname. + networking.useDHCP = false; + networking.interfaces.enp6s0.useDHCP = true; + + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/71831856-336e-43b5-9ed8-a657939f95a9"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/3B73-1D5D"; + fsType = "vfat"; + }; + + fileSystems."/home/mae" = + { + device = "/dev/disk/by-uuid/d7e91b96-f7e1-4feb-84d4-4e024746d73e"; + fsType = "btrfs"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/99d35be0-8935-4cec-bf58-4f666db922f0"; }]; + +} diff --git a/lib/attrs.nix b/lib/attrs.nix index 63df32c..50c72d2 100644 --- a/lib/attrs.nix +++ b/lib/attrs.nix @@ -37,9 +37,9 @@ rec { let # Everything that nix flake check requires for the packages output filter = (n: v: with v; let platforms = meta.hydraPlatforms or meta.platforms or [ ]; in - lib.isDerivation v && !meta.broken && builtins.elem system platforms); + lib.isDerivation v && !meta.broken && builtins.elem system platforms); in - lib.filterAttrs filter packages; + lib.filterAttrs filter packages; safeReadDir = path: lib.optionalAttrs (builtins.pathExists path) (builtins.readDir path); } diff --git a/lib/devos/mkHomeConfigurations.nix b/lib/devos/mkHomeConfigurations.nix index ab84393..c0588e2 100644 --- a/lib/devos/mkHomeConfigurations.nix +++ b/lib/devos/mkHomeConfigurations.nix @@ -4,9 +4,9 @@ with lib; let mkHomes = host: config: mapAttrs' (user: v: nameValuePair "${user}@${host}" v) - config.config.system.build.homes; + config.config.system.build.homes; hmConfigs = mapAttrs mkHomes self.nixosConfigurations; in -foldl recursiveUpdate {} (attrValues hmConfigs) +foldl recursiveUpdate { } (attrValues hmConfigs) diff --git a/lib/devos/mkProfileAttrs.nix b/lib/devos/mkProfileAttrs.nix index d89c6ba..142eae8 100644 --- a/lib/devos/mkProfileAttrs.nix +++ b/lib/devos/mkProfileAttrs.nix @@ -2,16 +2,16 @@ let mkProfileAttrs = /** - Synopsis: mkProfileAttrs _path_ + Synopsis: mkProfileAttrs _path_ - Recursively collect the subdirs of _path_ containing a default.nix into attrs. - This sets a contract, eliminating ambiguity for _default.nix_ living under the - profile directory. + Recursively collect the subdirs of _path_ containing a default.nix into attrs. + This sets a contract, eliminating ambiguity for _default.nix_ living under the + profile directory. - Example: - let profiles = mkProfileAttrs ./profiles; in - assert profiles ? core.default; 0 - **/ + Example: + let profiles = mkProfileAttrs ./profiles; in + assert profiles ? core.default; 0 + **/ dir: let imports = diff --git a/profiles/amd/default.nix b/profiles/amd/default.nix new file mode 100644 index 0000000..0391348 --- /dev/null +++ b/profiles/amd/default.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: +{ + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + amdvlk + ]; + boot.initrd.kernelModules = [ "amdgpu" ]; + boot.kernelModules = [ "kvm-amd" ]; +} diff --git a/profiles/core/default.nix b/profiles/core/default.nix index fd81ec3..3d35073 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -27,6 +27,7 @@ in manix moreutils nix-index + tmux nmap ripgrep whois diff --git a/profiles/develop/default.nix b/profiles/develop/default.nix index 05dc4af..60eb4c2 100644 --- a/profiles/develop/default.nix +++ b/profiles/develop/default.nix @@ -1,11 +1,11 @@ -{ pkgs, ... }: +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ - clang - nodejs - python3 - libcxx - git + clang + nodejs + python3 + libcxx + git ]; programs.adb.enable = true; diff --git a/profiles/game/default.nix b/profiles/game/default.nix index 899f629..66449db 100644 --- a/profiles/game/default.nix +++ b/profiles/game/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { environment.systemPackages = [ - pkgs.steam - pkgs.lutris + pkgs.steam + pkgs.lutris ]; } diff --git a/profiles/laptop/default.nix b/profiles/laptop/default.nix index eaa86b4..6f41351 100644 --- a/profiles/laptop/default.nix +++ b/profiles/laptop/default.nix @@ -1,3 +1,3 @@ -{ ... } : { +{ ... }: { services.xserver.libinput.enable = true; } diff --git a/profiles/sway/default.nix b/profiles/sway/default.nix index 177c9d2..475c796 100644 --- a/profiles/sway/default.nix +++ b/profiles/sway/default.nix @@ -1,9 +1,6 @@ { config, lib, pkgs, ... }: { - networking.interfaces.enp0s31f6.useDHCP = true; - networking.interfaces.wlp3s0.useDHCP = true; - xdg.portal.enable = true; sound.enable = true; diff --git a/suites/default.nix b/suites/default.nix index 797b391..f98158f 100644 --- a/suites/default.nix +++ b/suites/default.nix @@ -1,7 +1,8 @@ { users, profiles, userProfiles, ... }: { system = with profiles; rec { - base = [users.mae users.root]; + base = [ users.mae users.root ]; + amd = [ profiles.amd ]; desktop = base ++ [ sway develop game workstation ssh users.mae users.root ]; lap = desktop ++ [ laptop bluetooth print networkmanager ]; }; diff --git a/tests/lib.nix b/tests/lib.nix index 900cb57..e215157 100644 --- a/tests/lib.nix +++ b/tests/lib.nix @@ -92,7 +92,7 @@ lib.runTests { system = { bar = [ profiles.foo.default ]; allProfiles = [ profiles.foo.default profiles.t.default ]; - allUsers = []; + allUsers = [ ]; }; }; }; diff --git a/tests/profiles/t/default.nix b/tests/profiles/t/default.nix index e69de29..8b13789 100644 --- a/tests/profiles/t/default.nix +++ b/tests/profiles/t/default.nix @@ -0,0 +1 @@ + diff --git a/users/mae/default.nix b/users/mae/default.nix index 561fbb2..b65b117 100644 --- a/users/mae/default.nix +++ b/users/mae/default.nix @@ -3,55 +3,61 @@ home-manager.users.mae = { imports = [ ../profiles/git ]; programs.neovim = { - enable = true; - vimdiffAlias = true; - withNodeJs = true; - - plugins = with pkgs.vimPlugins; [ - { plugin = coc-nvim; - config = '' - nmap (coc-rename) - - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\" : "\" - - " Remap and for scroll float windows/popups. - if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - endif - ''; } - fzf-vim - { plugin = iceberg-vim; - config = "colorscheme iceberg";} - vim-sleuth - coc-json - coc-html - coc-tsserver - neoformat - undotree - { plugin = vim-jsdoc; - config = '' - let g:jsdoc_formatter = "tsdoc" - let g:typescript_indent_disable = 1 - '';} - ]; - extraConfig = '' - set background=dark - set termguicolors - - set ic - set number - set autoindent - - set completeopt=menuone,noinsert,noselect - set shortmess+=c - ''; - }; + enable = true; + vimdiffAlias = true; + withNodeJs = true; + + plugins = with pkgs.vimPlugins; [ + { + plugin = coc-nvim; + config = '' + nmap (coc-rename) + + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" + + " Remap and for scroll float windows/popups. + if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + endif + ''; + } + fzf-vim + { + plugin = iceberg-vim; + config = "colorscheme iceberg"; + } + vim-sleuth + coc-json + coc-html + coc-tsserver + neoformat + undotree + { + plugin = vim-jsdoc; + config = '' + let g:jsdoc_formatter = "tsdoc" + let g:typescript_indent_disable = 1 + ''; + } + ]; + extraConfig = '' + set background=dark + set termguicolors + + set ic + set number + set autoindent + + set completeopt=menuone,noinsert,noselect + set shortmess+=c + ''; + }; }; users.users.mae = { uid = 1000; @@ -59,6 +65,6 @@ isNormalUser = true; hashedPassword = "$6$vyS4lqYbl3$OXztJnAC5ZayA4eCBSIRlYtsi9u1HnafsfNL28l4CJh0BISVlSj6D48CA80cshnvYW/EEzfEj7z4zTNFpJAT/."; shell = pkgs.zsh; - extraGroups = [ "wheel" "video" "lp" "scanner" "adbusers" "render"]; + extraGroups = [ "wheel" "video" "lp" "scanner" "adbusers" "render" ]; }; } diff --git a/users/modules/module-list.nix b/users/modules/module-list.nix index fe51488..1e3ec72 100644 --- a/users/modules/module-list.nix +++ b/users/modules/module-list.nix @@ -1 +1 @@ -[] +[ ]