This commit is contained in:
Bad 2021-04-06 13:37:40 +02:00
parent 01b0555117
commit bb0468d538
15 changed files with 286 additions and 159 deletions

View file

@ -17,11 +17,11 @@
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
},
"locked": {
"lastModified": 1615131736,
"narHash": "sha256-z4Er9Cj3WpBDO/saLxqb7IypEvVP0/1AnO6rY5NB03Y=",
"lastModified": 1617051928,
"narHash": "sha256-50Qd32ebudm1kL/prp44WjZH5gDkKkZXWy8HPW8lZ88=",
"owner": "hercules-ci",
"repo": "hercules-ci-agent",
"rev": "a1513a51e8efb96e990a562e6e724e17f2789978",
"rev": "4110b97734d54dc0df22e6e01a426038e236d710",
"type": "github"
},
"original": {
@ -37,11 +37,11 @@
]
},
"locked": {
"lastModified": 1613595894,
"narHash": "sha256-MOk/7rCAUB5Lf4GL+HimvyAAZXYEw8gWsq5nW4PPQQA=",
"lastModified": 1616437843,
"narHash": "sha256-mOrPTDNW2hwryNBAVkmWuDdb9Owjb7AcSwob7ecfRIk=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "5c3146b75d5d478f0693d0ea6c83f1da8382ff56",
"rev": "1a760930266ac00b7d422320c0b01d583d294ec7",
"type": "github"
},
"original": {
@ -66,11 +66,11 @@
]
},
"locked": {
"lastModified": 1614654775,
"narHash": "sha256-3mLxoxIXSWUuKE8YgIuqM5AZzXFd1aWxkTlplEDeXIA=",
"lastModified": 1616406726,
"narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "6278b9bef5ad624676a565980417cbbef42d5227",
"rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d",
"type": "github"
},
"original": {
@ -81,11 +81,11 @@
},
"devshell": {
"locked": {
"lastModified": 1613641255,
"narHash": "sha256-iSvjFK4WYAKhuXCCtkY7uy/cFQTzS3D3Ml5WZqjEfL0=",
"lastModified": 1617631469,
"narHash": "sha256-kBoHeZPbDAfOCWjy+ialZYmlg2FXKaqHH7eH+15e3pk=",
"owner": "numtide",
"repo": "devshell",
"rev": "ff6cffba08600f5b7b43f398fcb58bef023bc4c4",
"rev": "5d2ad08eb7cb0cf1f73b6f6e0ccfd2508a4995d7",
"type": "github"
},
"original": {
@ -118,11 +118,11 @@
]
},
"locked": {
"lastModified": 1616724076,
"narHash": "sha256-SwbPXLjN2sLy4NL/GhodiJrdkIVZwGGTGiCN3JxH1cU=",
"lastModified": 1617625716,
"narHash": "sha256-B36WKNVwtmRk3oqJ9XbOca0iy1Ga1dW6E26iavRFPKQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fedfd430f96695997b3eaf8d7e82ca79406afa23",
"rev": "cc60c22c69e6967b732d02f072a9f1e30454e4f6",
"type": "github"
},
"original": {
@ -153,11 +153,11 @@
},
"nixos": {
"locked": {
"lastModified": 1615797423,
"narHash": "sha256-5NGDZXPQzuoxf/42NiyC9YwwhwzfMfIRrz3aT0XHzSc=",
"lastModified": 1617082367,
"narHash": "sha256-W0cQPGjc4IVzryaGycuoS8KZkXafS1P23w/fcKLoD5Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "266dc8c3d052f549826ba246d06787a219533b8f",
"rev": "04a2b269d8921505a2969fc9ec25c1f517f2b307",
"type": "github"
},
"original": {
@ -168,11 +168,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1615652054,
"narHash": "sha256-jqXKU8Ovpi7MmPRqGf2FB3QOPcZtGwO2MFc0AYiOPjg=",
"lastModified": 1617608389,
"narHash": "sha256-Dom5AICRbxorNjaP+7to8rSJ5+8I52UwaJu9M1GkO10=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "31f61b90ddb9257b94888ee17ccf96236e180c76",
"rev": "085790185c3e8a7dd6c2f456eaf15ffcc66b0ac9",
"type": "github"
},
"original": {
@ -183,11 +183,11 @@
},
"nur": {
"locked": {
"lastModified": 1615921934,
"narHash": "sha256-nURGM869KKA1+c1SHHsXKYcPXhHIuxWBjNXjJ90OzRQ=",
"lastModified": 1617651867,
"narHash": "sha256-ktlubMXrvk2HOAH0A0guiWNjebfEuV1CTqNjvApBlho=",
"owner": "nix-community",
"repo": "NUR",
"rev": "faf862e8cf009edfa38ecc61188f7a6ace293552",
"rev": "b78c87469acc055d40d54669e4e052a00e831f98",
"type": "github"
},
"original": {
@ -197,11 +197,11 @@
},
"override": {
"locked": {
"lastModified": 1615926763,
"narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=",
"lastModified": 1617658314,
"narHash": "sha256-HAlamxyHjggTZqF/xfeCZd9N9Xyq7cS/VfP+2VLuQ44=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b702a56d417647de4090ac56c0f18bdc7e646610",
"rev": "42368bf52159d0be87141e7a7fd4949ff2f29148",
"type": "github"
},
"original": {
@ -260,11 +260,11 @@
},
"utils": {
"locked": {
"lastModified": 1614513358,
"narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
"lastModified": 1617631617,
"narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
"rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
"type": "github"
},
"original": {

57
hosts/teapot.nix Normal file
View file

@ -0,0 +1,57 @@
{ suites, ... }:
{
imports = suites.lap;
# 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. Its 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?
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/75b8df4a-8839-40cd-92ad-dc83007199f4";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/B940-3C52";
fsType = "vfat";
};
swapDevices =
[ { 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";
};
boot.loader.efi.efiSysMountPoint = "/boot";
boot.initrd.luks.devices = {
root = {
device = "/dev/disk/by-uuid/d51c0e1d-7b44-4011-bb8c-8773df2ca890";
preLVM = true;
};
};
networking.networkmanager.enable = true;
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
hardware.bluetooth.enable = true;
services.blueman.enable = true;
}

View file

@ -7,7 +7,6 @@ in
nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
environment = {
systemPackages = with pkgs; [
binutils
coreutils
@ -17,7 +16,10 @@ in
dnsutils
dosfstools
fd
fzf
git
bat
neovim
gotop
gptfdisk
iputils
@ -27,106 +29,26 @@ in
nix-index
nmap
ripgrep
skim
tealdeer
utillinux
whois
];
shellInit = ''
export STARSHIP_CONFIG=${
pkgs.writeText "starship.toml"
(fileContents ./starship.toml)
}
'';
shellAliases =
let ifSudo = lib.mkIf config.security.sudo.enable;
in
{
# quick cd
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
# git
g = "git";
# grep
grep = "rg";
gi = "grep -i";
# internet ip
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
# nix
n = "nix";
np = "n profile";
ni = "np install";
nr = "np remove";
ns = "n search --no-update-lock-file";
nf = "n flake";
nepl = "n repl '<nixpkgs>'";
srch = "ns nixos";
orch = "ns override";
nrb = ifSudo "sudo nixos-rebuild";
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';
# fix nixos-option
nixos-option = "nixos-option -I nixpkgs=${toString ../../compat}";
# sudo
s = ifSudo "sudo -E ";
si = ifSudo "sudo -i";
se = ifSudo "sudoedit";
# top
top = "gotop";
# systemd
ctl = "systemctl";
stl = ifSudo "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
up = ifSudo "s systemctl start";
dn = ifSudo "s systemctl stop";
jtl = "journalctl";
};
};
fonts = {
fonts = with pkgs; [ powerline-fonts dejavu_fonts ];
fontconfig.defaultFonts = {
monospace = [ "DejaVu Sans Mono for Powerline" ];
sansSerif = [ "DejaVu Sans" ];
};
};
nix = {
autoOptimiseStore = true;
gc.automatic = true;
optimise.automatic = true;
useSandbox = true;
allowedUsers = [ "@wheel" ];
trustedUsers = [ "root" "@wheel" ];
extraOptions = ''
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
@ -134,17 +56,9 @@ in
};
programs.bash = {
promptInit = ''
eval "$(${pkgs.starship}/bin/starship init bash)"
'';
interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
'';
};
time.timeZone = "Europe/Warsaw";
i18n.defaultLocale = "en_US.UTF-8";
services.earlyoom.enable = true;
users.mutableUsers = false;
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
clang
nodejs
python3
libcxx
git
];
programs.adb.enable = true;
}

View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.steam
pkgs.lutris
];
}

View file

@ -0,0 +1,3 @@
{ ... } : {
services.xserver.libinput.enable = true;
}

View file

@ -0,0 +1,5 @@
{ ... }: {
networking.networkmanager = {
enable = true;
};
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
services.printing.enable = true;
hardware.sane.enable = true;
hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
}

8
profiles/ssh/default.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }: {
services.openssh = {
enable = true;
forwardX11 = true;
permitRootLogin = "no";
startWhenNeeded = true;
};
}

72
profiles/sway/default.nix Normal file
View file

@ -0,0 +1,72 @@
{ config, lib, pkgs, ... }:
{
networking.interfaces.enp0s31f6.useDHCP = true;
networking.interfaces.wlp3s0.useDHCP = true;
xdg.portal.enable = true;
sound.enable = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
extraModules = [ pkgs.pulseaudio-modules-bt ];
};
hardware.opengl = {
enable = true;
driSupport = true;
};
services.xserver.enable = true;
services.xserver.displayManager = {
defaultSession = "sway";
autoLogin = { enable = true; user = "mae"; };
gdm.enable = true;
};
fonts.fonts = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
fira-code
fira-code-symbols
mplus-outline-fonts
dina-font
proggyfonts
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
environment.systemPackages = with pkgs; [
brightnessctl
polkit_gnome
];
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
extraPackages = with pkgs; [
breeze-gtk
breeze-qt5
waybar
swaylock
swaybg
xwayland
wl-clipboard
grim
slurp
rofi
rofi-emoji
kitty
mako
sway-contrib.grimshot
i3status
alacritty
];
};
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
mpv
firefox-wayland
nomacs
libreoffice
];
}

View file

@ -1,8 +1,9 @@
{ users, profiles, userProfiles, ... }:
{
system = with profiles; rec {
base = [ users.nixos users.root ];
base = [users.mae users.root];
desktop = base ++ [ sway develop game workstation ssh users.mae users.root ];
lap = desktop ++ [ laptop bluetooth print networkmanager ];
};
user = with userProfiles; rec {
base = [ direnv git ];

64
users/mae/default.nix Normal file
View file

@ -0,0 +1,64 @@
{ pkgs, ... }:
{
home-manager.users.mae = {
imports = [ ../profiles/git ];
programs.neovim = {
enable = true;
vimdiffAlias = true;
withNodeJs = true;
plugins = with pkgs.vimPlugins; [
{ plugin = coc-nvim;
config = ''
nmap <silent> <F2> <Plug>(coc-rename)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
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;
isNormalUser = true;
hashedPassword = "$6$vyS4lqYbl3$OXztJnAC5ZayA4eCBSIRlYtsi9u1HnafsfNL28l4CJh0BISVlSj6D48CA80cshnvYW/EEzfEj7z4zTNFpJAT/.";
shell = pkgs.zsh;
extraGroups = [ "wheel" "video" "lp" "scanner" "adbusers" "render"];
};
}

View file

@ -5,41 +5,5 @@
extraConfig = {
pull.rebase = false;
};
aliases = {
a = "add -p";
co = "checkout";
cob = "checkout -b";
f = "fetch -p";
c = "commit";
p = "push";
ba = "branch -a";
bd = "branch -d";
bD = "branch -D";
d = "diff";
dc = "diff --cached";
ds = "diff --staged";
r = "restore";
rs = "restore --staged";
st = "status -sb";
# reset
soft = "reset --soft";
hard = "reset --hard";
s1ft = "soft HEAD~1";
h1rd = "hard HEAD~1";
# logging
lg =
"log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
plog =
"log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
tlog =
"log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
rank = "shortlog -sn --no-merges";
# delete merged branches
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
};
};
}