Pulled out most config to be generic across systems and add in home-manager module.
This commit is contained in:
13
flake.lock
generated
13
flake.lock
generated
@@ -23,18 +23,17 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1672968032,
|
"lastModified": 1672953546,
|
||||||
"narHash": "sha256-26Jns3GmHem44a06UN5Rj/KOD9qNJThyQrom02Ijur8=",
|
"narHash": "sha256-oz757DnJ1ITvwyTovuwG3l9cX6j9j6/DH9eH+cXFJmc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2dea8991d89b9f1e78d874945f78ca15f6954289",
|
"rev": "a518c77148585023ff56022f09c4b2c418a51ef5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-22.11",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"type": "indirect"
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|||||||
174
flake.nix
174
flake.nix
@@ -2,8 +2,7 @@
|
|||||||
description = "System config";
|
description = "System config";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
#nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -18,32 +17,126 @@
|
|||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
overlays = [];
|
overlays = [];
|
||||||
};
|
};
|
||||||
in {
|
homeManagerSharedModule = {
|
||||||
nixosConfigurations.nixos-desktop = nixpkgs.lib.nixosSystem {
|
home-manager.useGlobalPkgs = true;
|
||||||
inherit system;
|
home-manager.users.nathan = { config, pkgs, lib, ... }:{
|
||||||
specialArgs = attrs;
|
# This value determines the Home Manager release that your
|
||||||
modules = [
|
# configuration is compatible with. This helps avoid breakage
|
||||||
({ config, lib, pkgs, modulesPath, ... }: {
|
# when a new Home Manager release introduces backwards
|
||||||
# HARDWARE
|
# incompatible changes.
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
#
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
|
# You can update Home Manager without changing this value. See
|
||||||
boot.initrd.kernelModules = [ ];
|
# the Home Manager release notes for a list of state version
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
# changes in each release.
|
||||||
boot.extraModulePackages = [ ];
|
home.stateVersion = "22.11";
|
||||||
fileSystems."/" = { device = "/dev/disk/by-uuid/163c1731-2f66-436b-a74f-20f84ec628dd"; fsType = "ext4"; };
|
|
||||||
fileSystems."/boot" = { device = "/dev/disk/by-uuid/9C44-5411"; fsType = "vfat"; };
|
|
||||||
swapDevices = [ ];
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
# END HARDWARE
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
home.packages = with pkgs; [ ];
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
programs.starship = {
|
||||||
networking.hostName = "nixos-desktop"; # Define your hostname.
|
enable = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
settings = {
|
||||||
|
add_newline = false;
|
||||||
|
format = lib.concatStrings [
|
||||||
|
"$username"
|
||||||
|
"$hostname"
|
||||||
|
"$directory"
|
||||||
|
"$jobs"
|
||||||
|
"$cmd_duration"
|
||||||
|
"$character"
|
||||||
|
];
|
||||||
|
directory = {
|
||||||
|
truncation_length = 10;
|
||||||
|
truncate_to_repo = false;
|
||||||
|
};
|
||||||
|
scan_timeout = 10;
|
||||||
|
character = {
|
||||||
|
success_symbol = "➜";
|
||||||
|
error_symbol = "➜";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
sessionVariables = {
|
||||||
|
};
|
||||||
|
profileExtra = ''
|
||||||
|
if [ -e /home/nathan/.nix-profile/etc/profile.d/nix.sh ]; then . /home/nathan/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Nathan Braswell";
|
||||||
|
userEmail = "nathan@braswell.email";
|
||||||
|
};
|
||||||
|
programs.vim = {
|
||||||
|
enable = true;
|
||||||
|
plugins = with pkgs.vimPlugins; [ nerdcommenter vim-polyglot ];
|
||||||
|
settings = {
|
||||||
|
# Is the need for these obliviated by vim-polyglot using sleuth?
|
||||||
|
#expandtab = false;
|
||||||
|
tabstop = 4;
|
||||||
|
shiftwidth = 4;
|
||||||
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
set number
|
||||||
|
set hlsearch
|
||||||
|
nnoremap <leader>m :bn<CR>
|
||||||
|
nnoremap <leader>t :tabnew<CR>
|
||||||
|
nnoremap <leader>. :tabn<CR>
|
||||||
|
nnoremap <leader>, :tabp<CR>
|
||||||
|
nnoremap <leader>v :vsplit<CR>
|
||||||
|
nnoremap <leader>h :split<CR>
|
||||||
|
nnoremap <leader>q :q<CR>
|
||||||
|
inoremap jk <Esc>
|
||||||
|
inoremap kj <Esc>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
programs.tmux = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
#$Id: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
|
||||||
|
#
|
||||||
|
# vim-keys.conf, v1.2 2010/09/12
|
||||||
|
#
|
||||||
|
# By Daniel Thau. Public domain.
|
||||||
|
#
|
||||||
|
# This configuration file binds many vi- and vim-like bindings to the
|
||||||
|
# appropriate tmux key bindings. Note that for many key bindings there is no
|
||||||
|
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
|
||||||
|
# differently from the previous versions
|
||||||
|
|
||||||
|
# split windows like vim
|
||||||
|
# vim's definition of a horizontal/vertical split is reversed from tmux's
|
||||||
|
bind s split-window -v
|
||||||
|
bind v split-window -h
|
||||||
|
|
||||||
|
# move around panes with hjkl, as one would in vim after pressing ctrl-w
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
|
# resize panes like vim
|
||||||
|
# feel free to change the "1" to however many lines you want to resize by, only
|
||||||
|
# one at a time can be slow
|
||||||
|
bind < resize-pane -L 1
|
||||||
|
bind > resize-pane -R 1
|
||||||
|
bind - resize-pane -D 1
|
||||||
|
bind + resize-pane -U 1
|
||||||
|
|
||||||
|
# bind : to command-prompt like vim
|
||||||
|
# this is the default in tmux already
|
||||||
|
bind : command-prompt
|
||||||
|
|
||||||
|
# vi-style controls for copy mode
|
||||||
|
setw -g mode-keys vi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
commonConfigFunc = ({ config, lib, pkgs, modulesPath, ... }: {
|
||||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
|
|
||||||
users.extraUsers.nathan = {
|
users.extraUsers.nathan = {
|
||||||
name = "nathan";
|
name = "nathan";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
@@ -74,7 +167,7 @@
|
|||||||
swaylock # lockscreen
|
swaylock # lockscreen
|
||||||
swayidle
|
swayidle
|
||||||
#xwayland # for legacy apps
|
#xwayland # for legacy apps
|
||||||
waybar # status bar
|
#waybar # status bar
|
||||||
mako # notification daemon
|
mako # notification daemon
|
||||||
kanshi # autorandr
|
kanshi # autorandr
|
||||||
bemenu # is this right?
|
bemenu # is this right?
|
||||||
@@ -147,7 +240,34 @@
|
|||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
networking.firewall.enable = false;
|
networking.firewall.enable = false;
|
||||||
system.stateVersion = "22.11"; # Did you read the comment?
|
system.stateVersion = "22.11"; # Did you read the comment?
|
||||||
})
|
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
nixosConfigurations.nixos-desktop = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = attrs;
|
||||||
|
modules = [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
homeManagerSharedModule
|
||||||
|
({ config, lib, pkgs, modulesPath, ... }@innerArgs: (lib.recursiveUpdate (commonConfigFunc innerArgs) {
|
||||||
|
# HARDWARE
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
fileSystems."/" = { device = "/dev/disk/by-uuid/163c1731-2f66-436b-a74f-20f84ec628dd"; fsType = "ext4"; };
|
||||||
|
fileSystems."/boot" = { device = "/dev/disk/by-uuid/9C44-5411"; fsType = "vfat"; };
|
||||||
|
swapDevices = [ ];
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
# END HARDWARE
|
||||||
|
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
networking.hostName = "nixos-desktop"; # Define your hostname.
|
||||||
|
}))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user