Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hauskens committed Nov 26, 2023
1 parent 953c48d commit 575c07a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 92 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ Contributions are also welcome with these guidelines:
- Features should not cause data loss or be destructive
- It should **not** spark joy

![Inspirational comic strip](https://feelafraidcomic.com/comics/2011-05-13-welcome-to-hell.png)
<img src="https://feelafraidcomic.com/comics/2011-05-13-welcome-to-hell.png" width="375" height="563">

[feelafraidcomic.com](https://feelafraidcomic.com/60.php) - [@feel_afraid](https://twitter.com/feel_afraid)

## Feature wishlist
Expand Down
38 changes: 7 additions & 31 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 52 additions & 51 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@

{
description = "BigBrother Distro";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";

home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
#calamares-bb.url = "git+file:///home/hausken/Projects/BigBother/calamares";
calamares-bb.url = "github:hauskens/calamares-nixos-extensions";
plasma-manager.url = "github:pjones/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};

nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, nixos-generators, calamares-bb, home-manager, plasma-manager, ... }: {
calamares-bb = {
url = "github:hauskens/calamares-nixos-extensions";
#url = "git+file:///home/hausken/Projects/BigBother/calamares"; # for testing calamares changes locally.
};

# plasma-manager.url = "github:pjones/plasma-manager";
# plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
# plasma-manager.inputs.home-manager.follows = "home-manager";
};

outputs = { self, nixpkgs, nixos-generators, calamares-bb, home-manager, ... }:
let
version = "1.2";
in
{
nixosModules.bigbotherinstaller = {config, ...}: {
nixpkgs.hostPlatform = "x86_64-linux";
imports = [
nixos-generators.nixosModules.all-formats
];
nixpkgs.hostPlatform = "x86_64-linux";

formatConfigs.isogen = {config, modulesPath, ...}: {
imports = ["${toString modulesPath}/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix"];
Expand All @@ -36,37 +45,29 @@
};
};

# This is the configuration used when calamares installer installs the system.
nixosConfigurations.bigbotherpc = nixpkgs.lib.nixosSystem {
modules = [
./os.nix
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nixos = import ./home.nix;
#home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
];
};

# This is the configuration used inside the ISO
nixosConfigurations.bigbotherinstaller = nixpkgs.lib.nixosSystem {
modules = [
self.nixosModules.bigbotherinstaller
./os.nix
./installer.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nixos = import ./home.nix;
#home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
({ pkgs, ... }: {
environment.systemPackages = [ calamares-bb.packages.x86_64-linux.calamares-nixos-extensions ];
nixpkgs.config.packageOverrides = localPkgs: {
calamares-nixos-extensions = calamares-bb.packages.x86_64-linux.calamares-nixos-extensions;
};

# Copy the files needed for the installer to the ISO, Calamares will copy these onto the system
environment.etc."bigbother/os.nix".source = "${self}/os.nix";
environment.etc."bigbother/flake.nix".source = "${self}/flake.nix";
environment.etc."bigbother/flake.lock".source = "${self}/flake.lock";
Expand All @@ -75,40 +76,40 @@
})
];
};

# Generate iso and torrent
packages.x86_64-linux.makeTorrent = nixpkgs.legacyPackages.x86_64-linux.stdenv.mkDerivation {
name = "make-torrent";
buildInputs = [ nixpkgs.legacyPackages.x86_64-linux.mktorrent ];
name = "make-torrent";
buildInputs = [ nixpkgs.legacyPackages.x86_64-linux.mktorrent ];

# Use the output of the bigbotherinstaller as the source
src = self.nixosConfigurations.bigbotherinstaller.config.formats.isogen;
src = self.nixosConfigurations.bigbotherinstaller.config.formats.isogen; # Use the output of the bigbotherinstaller as the source
unpackPhase = "true"; # Don't unpack the iso, we just want to use it as a source

unpackPhase = "true";
version = version;
trackers = [
"udp://fosstorrents.com:6969/announce"
"http://fosstorrents.com:6969/announce"
"udp://tracker.opentrackr.org:1337/announce"
"udp://tracker.openbittorrent.com:6969/announce"
"http://tracker.openbittorrent.com:80/announce"
"udp://93.158.213.92:1337/announce"
];
comment ="BigBother Linux distro <https://github.com/BigBotherLinux/BigBother>";
iso_readme = "This is an iso for the Linux distro BigBother, read more about it here: https://github.com/BigBotherLinux/BigBother";

version = "1.1";
trackers = [
"udp://fosstorrents.com:6969/announce"
"http://fosstorrents.com:6969/announce"
"udp://tracker.opentrackr.org:1337/announce"
"udp://tracker.openbittorrent.com:6969/announce"
"http://tracker.openbittorrent.com:80/announce"
"udp://93.158.213.92:1337/announce"
];
comment ="BigBother Linux distro <https://github.com/BigBotherLinux/BigBother>";
iso_readme = "This is an iso for the Linux distro BigBother, read more about it here: https://github.com/BigBotherLinux/BigBother";

installPhase = ''
mkdir -p $out/BigBother-v$version-installer-iso
cp $src $out/BigBother-v$version-installer-iso/BigBother-v$version.iso
echo "$iso_readme" > $out/BigBother-v$version-installer-iso/no-need-to-readme.txt
installPhase = ''
mkdir -p $out
cp $src $out/BigBother-v$version.iso
echo "$iso_readme" > $out/no-need-to-readme.txt
tracker_args=""
for tracker in ''${trackers[@]}; do
tracker_args="$tracker_args -a $tracker"
done
tracker_args=""
for tracker in ''${trackers[@]}; do
tracker_args="$tracker_args -a $tracker"
done
mktorrent $tracker_args -c "$comment" --name "BigBother v$version installer iso" -o $out/BigBotherv$version.torrent $out
'';
};
mktorrent $tracker_args -c "$comment" --name "BigBother-v$version-installer-iso" -o $out/BigBotherv$version.torrent $out/BigBother-v$version-installer-iso
'';
};
};
}
37 changes: 28 additions & 9 deletions os.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
{ config, pkgs, username, ... }:
{

imports = [
./modules/version.nix
];
bigbother.osInfo.enable = true; # version numbers in lsb-release


# we need it specifically for hyper-v,
# im not sure if nixos-generate-config would have picked this up, so maybe it is only needed in the iso
virtualisation.hypervGuest.enable = true;

nixpkgs.config.allowUnfree = true;

nix.settings = {
experimental-features = [ "nix-command" "flakes"];
};

imports = [
./modules/version.nix
];
bigbother.osInfo.enable = true;
boot.plymouth.logo = ./logo.png;

# Enable home manager for the user
# FYI: calamares will go in to this file and do a string replace on the username.
# It searches for 'users.nixos' and replaces it with 'users.<username>'
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nixos = import ./home.nix;

environment = {
systemPackages = with pkgs; [
microsoft-edge
lsb-release
];
# just learn vim lol

# Set shell settings, such as alias to vim
interactiveShellInit = ''
alias nano='vim'
'';

# Write files to /etc, this is the last resort if nixos modules can't do it
etc = {
# Lecture file for sudo
"/bb-sudoers.lecture".text = ''
You are trying to run a command with root privileges, hopefully you know what you're about to do.
'';
Expand All @@ -34,7 +53,7 @@
Defaults lecture_file = /etc/bb-sudoers.lecture
'';

# do not remember last logged in user
# Login screen: do not remember last logged in user
services.xserver.displayManager.sddm.settings.Users = {
RememberLastUser = false;
RememberLastSession = false;
Expand All @@ -45,7 +64,8 @@
boot.loader.grub = {
extraEntries = ''
menuentry "Accidental boot protection" {
clear
echo "Accidental boot avoided, shutting down."
sleep 3
clear
Expand All @@ -70,8 +90,7 @@
}
'';
extraConfig = "set theme=($drive2)${pkgs.breeze-grub}/grub/themes/breeze/theme.txt";
splashImage = null;
splashImage = null; # TODO: Add some branding here
extraEntriesBeforeNixOS = true;
};

}

0 comments on commit 575c07a

Please sign in to comment.