Compare commits

...

3 Commits

Author SHA1 Message Date
Giulio De Pasquale
b32b7cb1f5 git role to giulio on galuminum 2021-10-14 12:53:59 +01:00
Giulio De Pasquale
163cc286af roles with home-manager 2021-10-14 12:53:44 +01:00
Giulio De Pasquale
75a63c6329 huge reorganization 2021-10-13 13:29:07 +01:00
23 changed files with 234 additions and 229 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 = [ { user = "giulio"; } ]; };
gAluminum = util.mkHost { name = "gAluminum"; }; gAluminum = host.mkHost { name = "gAluminum"; users = [ { user = "giulio"; roles = [ "desktop" "ssh" "git" ]; } ]; roles = [ "gnome" ]; };
proxy = util.mkHost { name = "proxy"; }; proxy = host.mkHost { name = "proxy"; };
}; };
}; };
} }

View File

@ -1,67 +0,0 @@
{ config, pkgs, ... }:
let
albert_autostart = (pkgs.makeAutostartItem {
name = "albert";
package = pkgs.albert;
});
guake_autostart = (pkgs.makeAutostartItem {
name = "guake";
package = pkgs.guake;
});
in
{
imports = [
./zsh.nix
./code.nix
./git.nix
./gnome.nix
./ssh.nix
];
nixpkgs.config.allowUnfree = true;
home = {
stateVersion = "21.05";
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
packages = with pkgs; [
# essentials
albert
guake
# browsers
firefox
brave
chromium
# reversing
rizin
nmap
slack
signal-desktop
teams
discord
element-desktop
# music
spotify
# misc
bind
# system
gparted
sshfs
# autostart
albert_autostart
guake_autostart
];
};
}

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; };
}

40
lib/host.nix Normal file
View File

@ -0,0 +1,40 @@
{ pkgs, nixpkgs, nixos-unstable, unstable, home-manager, user, ... }:
{
mkHost = { name, users, roles ? [] }:
let
system = "x86_64-linux";
mkRole = role : import (../roles + "/${role}.nix");
users_mod= (map (u: user.mkUser {name = u.user; roles= u.roles; }) users);
roles_mod = (map (r: mkRole r) roles);
in nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{
imports = users_mod ++ roles_mod;
nixpkgs.pkgs = pkgs;
nix.nixPath = [
"nixpkgs=${nixpkgs}"
"unstable=${nixos-unstable}"
];
nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.unstable.flake = nixos-unstable;
users.users.root = {
shell = pkgs.zsh;
};
home-manager.users.root.imports = [ ../roles/home/common.nix ];
}
home-manager.nixosModules.home-manager
../roles/common.nix
../roles/acme.nix
../hosts/${name}/default.nix
];
};
}

23
lib/user.nix Normal file
View File

@ -0,0 +1,23 @@
{ pkgs, ...}:
{
mkUser = { name, roles ? [] }:
let
mkRole = role: import (../roles/home + "/${role}.nix");
roles_mod = (map (r: mkRole r) roles);
in {
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/common.nix ] ++ roles_mod;
};
}

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

@ -1,15 +1,26 @@
{ config, pkgs, lib, home, ... }: { config, pkgs, ... }:
{ {
nixpkgs.config.allowUnfree = true; imports = [ ./zsh.nix ];
home.packages = with pkgs; [ home = {
stateVersion = "21.05";
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
packages = with pkgs; [
rizin
sshfs
nixfmt nixfmt
vscode
]; ];
};
programs.neovim = { programs.neovim = {
enable = true; enable = true;
#package = pkgs.unstable.neovim-unwrapped;
extraConfig = '' extraConfig = ''
" syntax " syntax
syntax enable syntax enable
@ -65,6 +76,10 @@
" 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,7 +98,7 @@
vim-fugitive vim-fugitive
vim-yaml vim-yaml
vim-autoformat vim-autoformat
vimtex
]; ];
}; };
} }

42
roles/home/desktop.nix Normal file
View File

@ -0,0 +1,42 @@
{ pkgs, ... }:
let
albert_autostart = (pkgs.makeAutostartItem {
name = "albert";
package = pkgs.albert;
});
guake_autostart = (pkgs.makeAutostartItem {
name = "guake";
package = pkgs.guake;
});
in
{
imports = [ ./gnome.nix ];
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [
albert
guake
firefox
brave
chromium
slack
signal-desktop
teams
discord
element-desktop
spotify
gparted
libreoffice
vscode
jetbrains.idea-ultimate
albert_autostart
guake_autostart
];
}

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,38 +0,0 @@
{ nixos-unstable, nixpkgs, home-manager, ... }:
{
mkHost = {name}:
let
system = "x86_64-linux";
unstable = import nixos-unstable {
inherit system;
config.allowUnfree = true;
};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ (final: prev: { inherit unstable; }) ];
};
in nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{
nixpkgs.pkgs = pkgs;
nix.nixPath = [
"nixpkgs=${nixpkgs}"
"unstable=${nixos-unstable}"
];
nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.unstable.flake = nixos-unstable;
}
./common.nix
./users.nix
home-manager.nixosModules.home-manager
./hosts/${name}/default.nix
./acme.nix
];
};
}

View File

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