Skip to content

Commit

Permalink
Merge pull request #80 from GLF-OS/dev
Browse files Browse the repository at this point in the history
Merge dev -> stable
  • Loading branch information
camini authored Dec 18, 2024
2 parents 84602ea + 83f1b09 commit 613c2ee
Show file tree
Hide file tree
Showing 34 changed files with 1,834 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*~
,*
.*.swp
.DS_STORE
result
*.org
*.qcow2
iso
__pycache__/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# make without argument will perform a iso & install
all: iso install

# Check configuration only without build
check:
nix --extra-experimental-features "nix-command flakes" flake check --no-build
# Check configuration only with build
build:
nix --extra-experimental-features "nix-command flakes" build -L .#nixosConfigurations.glf-installer.config.system.build.toplevel

# Build new iso
iso:
nix --extra-experimental-features "nix-command flakes" build -L .#iso

build-vm:
nixos-rebuild build-vm -I nixos-config=./nix-cfg/configuration.nix && ./result/bin/run-glfos-vm

# Update flake.lock
update:
nix --extra-experimental-features "nix-command flakes" flake update

# Clean local build
clean:
@if [ -L "result" ]; then rm result; fi
nix-collect-garbage
@if [ -d "iso" ]; then rm -r iso; fi

# Copy image and compute sha256sum
SRC_DIR = result/iso
DEST_DIR = iso
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
install:
@SRC_IMG=$$(ls -t $(SRC_DIR) | tail -1); \
DST_IMG="$${SRC_IMG/-x86_64-linux.iso/_$(GIT_BRANCH).iso}"; \
if [ -n "$$SRC_IMG" ]; then \
echo "Copying $(SRC_DIR)/$$SRC_IMG to $(DEST_DIR)/$$DST_IMG ..."; \
install -d $(DEST_DIR); \
install -m 644 "$(SRC_DIR)/$$SRC_IMG" $(DEST_DIR)/$$DST_IMG && \
cd $(DEST_DIR) && \
sha256sum "$$DST_IMG" > "$$DST_IMG.sha256sum"; \
cat "$$DST_IMG.sha256sum"; \
fi

.PHONY: all test clean iso update install
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Construction de l'ISO

Pour construire l'ISO, suivez les étapes ci-dessous :

1. **Accédez au répertoire** :
```sh
cd chemin/vers/Nixos-by-GLF
```

2. **Exécutez la commande de construction** :
```sh
nix build .#iso
```

# Alternative (via utilisation de make)

> [!NOTE]
> Pré-requis: `gnumake` doit être installé
> Peut être installé temporairement via la commande `nix-shell -p gnumake`
1. **Contruction de l'iso** :

La construction de l'iso peut être lancée via la commande:
```
make
```

Cette commande exécutera 2 opérations consécutives: `make iso` et `make install`.

La première aura le même effet que la commande `nix build .#iso` hormis qu'elle ajoutera automatiquement les extra-features `nix-command flakes`.
La deuxième copiera l'ISO généré (suffixé du nom de la branche courante) dans le répertoire `iso` à la racine du projet et créera son fichier hash associé.

Exemple de résultat:
```
$ ls iso
glfos-24.11.20241202.f9f0d5c_dev.iso glfos-24.11.20241202.f9f0d5c_dev.iso.sha256sum
```

2. **Nettoyage après la construction** :

Cette commande effacera tout ce qui a été généré localement, ISOs inclus.

```
make clean
```

3. **Test de la configuration nix** :

Deux méthodes ici, la première permet de tester la configuration sans "build" et de repérer les erreurs de syntaxes.

```bash
make check
```

> [!NOTE]
> Les fichiers vérifiés sont ceux qui sont appelés par le flocon (ex: le répertoire glf)
> Tant que votre fichier est appelé par le flocon, configuration.nix ou un default.nix, le fichier sera vérifié.
La seconde méthode vérifie la syntaxe et construit la configuration sans générer d'iso (la configuration est mise en cache).

```bash
make build
```

4. **Test de la configuration dans une machine virtuelle** :

La configuration peut-être construite et lancé dans une machine virtuelle (depuis nixos uniquement)

```bash
make build-vm
```
26 changes: 26 additions & 0 deletions flake.lock

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

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
inputs = { nixpkgs.url = "nixpkgs/nixos-24.11"; };

outputs = { nixpkgs, ... } @ inputs:
let system = "x86_64-linux";
in
rec
{
iso = nixosConfigurations."glf-installer".config.system.build.isoImage;

nixosConfigurations = {
"glf-installer" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; }; inherit system;

modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix"
"${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix"
./nix-cfg/configuration.nix
{
nixpkgs.overlays = [
(self: super: {
calamares-nixos-extensions = super.calamares-nixos-extensions.overrideAttrs (oldAttrs: {
postInstall = ''
cp ${./patches/calamares-nixos-extensions/modules/nixos/main.py} $out/lib/calamares/modules/nixos/main.py
cp -r ${./patches/calamares-nixos-extensions/config/settings.conf} $out/share/calamares/settings.conf
cp -r ${./patches/calamares-nixos-extensions/config/modules/packagechooser.conf} $out/share/calamares/modules/packagechooser.conf
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/show.qml} $out/share/calamares/branding/nixos/show.qml
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/white.png} $out/share/calamares/branding/nixos/white.png
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/base.png} $out/share/calamares/branding/nixos/base.png
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/fast.png} $out/share/calamares/branding/nixos/fast.png
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/gaming.png} $out/share/calamares/branding/nixos/gaming.png
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/logo-glf-os.svg} $out/share/calamares/branding/nixos/logo-glf-os.svg
cp -r ${./patches/calamares-nixos-extensions/branding/nixos/branding.desc} $out/share/calamares/branding/nixos/branding.desc
'';
});
})
];
}
({ config, ... }: {
isoImage = {
# change default partition name (cannot exceed 32 bytes)
# volumeID = nixpkgs.lib.mkDefault "glfos${nixpkgs.lib.optionalString (config.isoImage.edition != "") "-${config.isoImage.edition}"}-${config.system.nixos.release}";
volumeID = nixpkgs.lib.mkDefault "glfos-${config.system.nixos.version}";

includeSystemBuildDependencies = false;
storeContents = [ config.system.build.toplevel ];
squashfsCompression = "zstd -Xcompression-level 22";
contents = [{
source = ./nix-cfg;
target = "/nix-cfg";
}];
};
})
];
};
};
};
}
31 changes: 31 additions & 0 deletions nix-cfg/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NE TOUCHEZ A RIEN
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{ config, pkgs, lib, ... }:
{
imports = [
./hardware-configuration.nix
./glf
];

i18n.defaultLocale = "fr_FR.UTF-8";

console.keyMap = "fr";
services.xserver = {
enable = true;
xkb.layout = "fr";
xkb.variant = "";
excludePackages = [ pkgs.xterm ];
};

users.users.test = {
isNormalUser = true;
description = "test";
extraGroups = [ "networkmanager" "wheel" "render" ];
};

nvidia_config.enable = true;

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

}
14 changes: 14 additions & 0 deletions nix-cfg/glf/boot.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ pkgs, config, lib, ... }:
{
boot = {
tmp.cleanOnBoot = true;
supportedFilesystems.zfs = lib.mkForce false;

# kernelPackages = pkgs.linuxPackages;
# kernelPackages = pkgs.linuxPackages_latest;
kernelPackages = pkgs.linuxPackages_zen;
# kernelPackages = pkgs.linuxPackages_xanmod_latest;

kernelParams = if builtins.elem "kvm-amd" config.boot.kernelModules then [ "amd_pstate=active" ] else [ ];
};
}
Binary file added nix-cfg/glf/dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions nix-cfg/glf/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
imports = [
./version.nix
./nh.nix
./boot.nix
./gnome.nix
./fstrim.nix
./gaming.nix
./firefox.nix
./paquets.nix
./pipewire.nix
./nvidia.nix
./system.nix
./updateConf.nix
];
}
15 changes: 15 additions & 0 deletions nix-cfg/glf/firefox.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
programs = {
firefox = {
enable = true;
wrapperConfig = {
pipewireSupport = true;
};
languagePacks = [ "fr" "en-US" ];
preferences = {
"intl.accept_languages" = "fr-fr,en-us,en";
"intl.locale.requested" = "fr,en-US";
};
};
};
}
6 changes: 6 additions & 0 deletions nix-cfg/glf/fstrim.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
services.fstrim = {
enable = true;
interval = "daily";
};
}
35 changes: 35 additions & 0 deletions nix-cfg/glf/gaming.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
heroic
lutris
mangohud
];

environment.sessionVariables = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d";
MANGOHUD_CONFIG = "control=mangohud,legacy_layout=0,horizontal,battery,time,time_format=%H\\:%M,gpu_stats,gpu_power,cpu_stats,ram,vram,fps,frametime=1,frame_timing=1,hud_no_margin,table_columns=14";
};

services.udev.extraRules = ''
# USB
ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
ATTRS{name}=="Sony Interactive Entertainment DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
# Bluetooth
ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
ATTRS{name}=="DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
'';

hardware.steam-hardware.enable = true;

programs = {
steam = {
enable = true;
package = pkgs.steam.override { extraEnv = { MANGOHUD = true; OBS_VKCAPTURE = true; }; };
extest.enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
};
}
Loading

0 comments on commit 613c2ee

Please sign in to comment.