huge reorganization

This commit is contained in:
Giulio De Pasquale 2021-10-13 13:29:07 +01:00
parent c9966c2f9b
commit 75a63c6329
21 changed files with 177 additions and 160 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "pkgs/binaryninja"]
path = pkgs/binaryninja
url = ssh://gitea@git.giugl.io:10022/peperunas/binaryninja.git
[submodule "pkgs/ida"]
path = pkgs/ida
url = ssh://gitea@git.giugl.io:10022/peperunas/ida.git

View File

@ -8,13 +8,29 @@
}; };
}; };
outputs = { self, nixpkgs, nixos-unstable, home-manager }: let outputs = inputs @ { self, nixpkgs, nixos-unstable, home-manager }: let
util = import ./utils.nix { inherit nixpkgs nixos-unstable home-manager; }; system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ (final: prev: { inherit unstable; }) ];
};
unstable = import nixos-unstable {
inherit system;
config.allowUnfree = true;
};
utils = import ./lib { inherit pkgs unstable nixpkgs nixos-unstable home-manager; };
inherit (utils) host;
inherit (utils) user;
in { in {
nixosConfigurations = { nixosConfigurations = {
architect = util.mkHost { name = "architect"; }; architect = host.mkHost { name = "architect"; users = [ "giulio" ]; };
gAluminum = util.mkHost { name = "gAluminum"; }; gAluminum = host.mkHost { name = "gAluminum"; users = [ "giulio" ]; roles = [ "gnome" ]; };
proxy = util.mkHost { name = "proxy"; }; proxy = host.mkHost { name = "proxy"; };
}; };
}; };
} }

View File

@ -5,14 +5,11 @@ let
in { in {
imports = [ imports = [
./hardware.nix ./hardware.nix
../../variables.nix ./wireguard.nix
../../common.nix
../../users.nix
]; ];
variables.hostname = hostname;
boot = { boot = {
supportedFilesystems = [ "ntfs" ];
loader = { loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
efi.efiSysMountPoint = "/boot/efi"; efi.efiSysMountPoint = "/boot/efi";
@ -30,68 +27,22 @@ in {
networking = { networking = {
hostName = hostname; hostName = hostname;
networkmanager.wifi = {
wg-quick.interfaces = { powersave = false;
giupi = { macAddress = "random";
address = ["10.3.0.2/32"];
privateKeyFile = "/etc/wireguard/giupi.key";
dns = ["10.3.0.1"];
peers = [
{
publicKey = "I4glUMvIGjjhvQMKhwGc8copPl2t9Us/YYRjT0BKuiw=";
allowedIPs = ["0.0.0.0/0"];
endpoint = "giugl.io:1194";
persistentKeepalive = 25;
}
];
};
}; };
}; };
time.timeZone = "Europe/London"; time.timeZone = "Europe/London";
services = { virtualisation.virtualbox.host.enable = true;
xserver = { virtualisation.virtualbox.host.enableExtensionPack = true;
enable = true; users.extraGroups.vboxusers.members = [ "giulio" ];
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
libinput.enable = true;
layout = "us";
xkbOptions = "eurosign:e";
};
printing.enable = true;
dbus.packages = with pkgs; [ gnome3.dconf ];
udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ];
};
services.printing.enable = true;
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [ efibootmgr ];
environment.systemPackages = with pkgs; [
wget
git
pciutils
curl
virtualbox
cmake
ninja
gdb
htop
glances
tcpdump
restic
gnomeExtensions.appindicator
binutils
efibootmgr
neovim
home-manager
];
fonts.fonts = with pkgs; [cascadia-code];
system.stateVersion = "21.05"; # Did you read the comment? system.stateVersion = "21.05"; # Did you read the comment?
security.pam.services.gdm.enableGnomeKeyring = true;
} }

View File

@ -0,0 +1,17 @@
{
networking.wg-quick.interfaces = {
giupi = {
address = ["10.3.0.2/32"];
privateKeyFile = "/etc/wireguard/giupi.key";
dns = ["10.3.0.1"];
peers = [
{
publicKey = "I4glUMvIGjjhvQMKhwGc8copPl2t9Us/YYRjT0BKuiw=";
allowedIPs = ["0.0.0.0/0"];
endpoint = "architect.devs.giugl.io:1194";
persistentKeepalive = 25;
}
];
};
};
}

5
lib/default.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, unstable, nixpkgs, nixos-unstable, home-manager, ...}:
rec {
user = import ./user.nix { inherit pkgs; };
host = import ./host.nix { inherit pkgs nixpkgs unstable nixos-unstable home-manager user; };
}

View File

@ -1,24 +1,21 @@
{ nixos-unstable, nixpkgs, home-manager, ... }: { pkgs, nixpkgs, nixos-unstable, unstable, home-manager, user, ... }:
{ {
mkHost = {name}: mkHost = { name, users, roles ? [] }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
unstable = import nixos-unstable { mkRole = role : import (../roles + "/${role}.nix");
inherit system;
config.allowUnfree = true;
};
pkgs = import nixpkgs { users_mod= (map (u: user.mkUser u) users);
inherit system; roles_mod = (map (r: mkRole r) roles);
config.allowUnfree = true;
overlays = [ (final: prev: { inherit unstable; }) ];
};
in nixpkgs.lib.nixosSystem { in nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
{ {
imports = users_mod ++ roles_mod;
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${nixpkgs}" "nixpkgs=${nixpkgs}"
@ -28,11 +25,10 @@
nix.registry.unstable.flake = nixos-unstable; nix.registry.unstable.flake = nixos-unstable;
} }
./common.nix
./users.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./hosts/${name}/default.nix ../roles/common.nix
./acme.nix ../roles/acme.nix
../hosts/${name}/default.nix
]; ];
}; };
} }

19
lib/user.nix Normal file
View File

@ -0,0 +1,19 @@
{ pkgs, ...}:
{
mkUser = name: {
fileSystems."/home/${name}/Downloads" = {
device = "tmpfs";
fsType = "tmpfs";
options = ["size=3G"];
};
users.users.${name} = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [ "wheel" ];
};
home-manager.users.${name}.imports = [ ../roles/home ];
};
}

1
pkgs/binaryninja Submodule

@ -0,0 +1 @@
Subproject commit 8ed0f28dc78dfc482c397056b73a6a1e680e8af0

1
pkgs/ida Submodule

@ -0,0 +1 @@
Subproject commit fe8eed08ff9f6e09abaa8216beaa45aa83767862

View File

@ -28,6 +28,8 @@
}; };
}; };
fonts.fonts = with pkgs; [cascadia-code];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
file file
pciutils pciutils
@ -41,12 +43,13 @@
restic restic
binutils binutils
neovim neovim
home-manager
ripgrep ripgrep
tmux tmux
parted parted
unzip unzip
tree tree
smartmontools smartmontools
nmap
ripgrep
]; ];
} }

20
roles/gnome.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs, ... }:
{
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
libinput.enable = true;
layout = "us";
xkbOptions = "eurosign:e";
};
dbus.packages = with pkgs; [ gnome3.dconf ];
udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ];
};
environment.systemPackages = with pkgs; [ gnomeExtensions.appindicator ];
security.pam.services.gdm.enableGnomeKeyring = true;
}

View File

@ -6,10 +6,13 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
nixfmt nixfmt
vscode vscode
jetbrains.idea-ultimate
]; ];
programs.neovim = { programs.neovim = {
enable = true; enable = true;
#package = pkgs.unstable.neovim-unwrapped;
extraConfig = '' extraConfig = ''
" syntax " syntax
syntax enable syntax enable
@ -65,6 +68,12 @@
" Fix for code not being aligned if between comment blocks " Fix for code not being aligned if between comment blocks
set cindent cinkeys-=0# set cindent cinkeys-=0#
set expandtab shiftwidth=2 tabstop=2 softtabstop=2 set expandtab shiftwidth=2 tabstop=2 softtabstop=2
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
''; '';
viAlias = true; viAlias = true;
@ -83,6 +92,7 @@
vim-fugitive vim-fugitive
vim-yaml vim-yaml
vim-autoformat vim-autoformat
vimtex
]; ];
}; };

View File

@ -19,7 +19,6 @@ in
./ssh.nix ./ssh.nix
]; ];
nixpkgs.config.allowUnfree = true;
home = { home = {
stateVersion = "21.05"; stateVersion = "21.05";
@ -29,16 +28,13 @@ in
}; };
packages = with pkgs; [ packages = with pkgs; [
# essentials
albert albert
guake guake
# browsers
firefox firefox
brave brave
chromium chromium
# reversing
rizin rizin
nmap nmap
@ -49,19 +45,25 @@ in
discord discord
element-desktop element-desktop
# music
spotify spotify
# misc
bind bind
# system
gparted gparted
sshfs sshfs
# autostart libreoffice
albert_autostart albert_autostart
guake_autostart guake_autostart
]; ];
}; };
programs = {
direnv = {
enable = true;
nix-direnv.enable = true;
nix-direnv.enableFlakes = true;
};
};
} }

View File

@ -4,6 +4,11 @@
compression = true; compression = true;
matchBlocks = { matchBlocks = {
"giugl.io" = {
user = "root";
identityFile = "~/.ssh/architectproxy";
};
"tommy.devs.giugl.io" = { "tommy.devs.giugl.io" = {
user = "giulio"; user = "giulio";
identityFile = "~/.ssh/tommypc"; identityFile = "~/.ssh/tommypc";

View File

@ -1,5 +1,5 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
home.packages = with pkgs; [ zsh ]; home.packages = with pkgs; [ zsh any-nix-shell ];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -9,5 +9,9 @@
plugins = [ "git" "sudo" "docker" "docker-compose" "adb" "systemd" ]; plugins = [ "git" "sudo" "docker" "docker-compose" "adb" "systemd" ];
theme = "bira"; theme = "bira";
}; };
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
'';
}; };
} }

8
roles/zsh.nix Normal file
View File

@ -0,0 +1,8 @@
{ ... }:
{
programs.zsh = {
enableBashCompletion = true;
enableCompletion = true;
};
}

View File

@ -1,35 +0,0 @@
{config, pkgs, home-manager, ...}:
{
users.users = {
giulio = {
description = "Giulio De Pasquale";
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [ "wheel" "docker" "networkmanager" ];
};
root = {
shell = pkgs.zsh;
};
};
programs.zsh = {
enableBashCompletion = true;
enableCompletion = true;
};
home-manager.users.root = {
imports = [ ./home/zsh.nix ./home/ssh.nix ./home/code.nix ];
};
home-manager.users.giulio = {
imports = [ ./home ];
};
fileSystems."/home/giulio/Downloads" = {
device = "tmpfs";
fsType = "tmpfs";
options = ["size=3G"];
};
}

View File

@ -1,12 +0,0 @@
{ config, lib, ... }:
with lib;
{
options.variables = mkOption {
type = types.attrs;
default = {};
};
config._module.args.variables = config.variables;
}