fix: update and fix flake.nix

This commit is contained in:
nhnn 2024-09-11 10:53:56 +03:00 committed by Inex Code
parent 6432dd98a6
commit d5a1fb05bd
5 changed files with 32 additions and 104 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

4
.gitignore vendored
View file

@ -45,3 +45,7 @@ app.*.map.json
.flatpak-builder/ .flatpak-builder/
flatpak-build/ flatpak-build/
flatpak-repo/ flatpak-repo/
# Direnv & Nix related
.direnv
result/

View file

@ -15,75 +15,26 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1661367362,
"narHash": "sha256-Qc8MXcV+YCPREu8kk6oggk23ZBKLqeQRAIsLbHEviPE=",
"owner": "guibou",
"repo": "nixGL",
"rev": "7165ffbccbd2cf4379b6cd6d2edd1620a427e5ae",
"type": "github"
},
"original": {
"owner": "guibou",
"repo": "nixGL",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1660551188, "lastModified": 1724824782,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", "narHash": "sha256-gNbzBakul/iGQgdJHLjfhocuPJGLPw2n4HGCBpKzAfk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1693250523,
"narHash": "sha256-y3up5gXMTbnCsXrNEB5j+7TVantDLUYyQLu/ueiXuyg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3efb0f6f404ec8dae31bdb1a9b17705ce0d6986e", "rev": "c1ce56e9c606b4cd31f0950768911b1171b8db51",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "nixos-unstable", "repo": "nixpkgs",
"type": "indirect" "rev": "c1ce56e9c606b4cd31f0950768911b1171b8db51",
"type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixgl": "nixgl", "nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
} }
} }
}, },

View file

@ -1,56 +1,32 @@
{ {
nixConfig.bash-prompt = "\[selfprivacy\]$ "; nixConfig.bash-prompt = "\[selfprivacy\]$ ";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/c1ce56e9c606b4cd31f0950768911b1171b8db51";
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixgl.url = "github:guibou/nixGL";
outputs = { self, nixpkgs, flake-utils, nixgl }: outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
lib = nixpkgs.lib;
fromYAML = path: lib.importJSON (pkgs.runCommand "yml2json" { nativeBuildInputs = [pkgs.yq]; src = path; } ''cat $src | yq . > $out'');
pubSpec = fromYAML ./pubspec.yaml;
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
config.android_sdk.accept_license = true; config.android_sdk.accept_license = true;
overlays = [ nixgl.overlay ];
}; };
spFlutter = pkgs.flutter324;
androidComposition = pkgs.androidenv.composeAndroidPackages { androidComposition = pkgs.androidenv.composeAndroidPackages {
platformToolsVersion = "34.0.4"; platformToolsVersion = "34.0.4";
buildToolsVersions = [ "34.0.0" ]; buildToolsVersions = [ "34.0.0" ];
platformVersions = [ "34" "33" "32" "31" "30" ]; platformVersions = [ "34" "33" "32" "31" "30" ];
}; };
spAndroidStudio = pkgs.symlinkJoin {
name = "spAndroidStudio";
paths = with pkgs; [
android-studio
flutter.unwrapped
# dart
gnumake
check
pkg-config
glibc
android-tools
jdk
git
];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/flutter \
--prefix ANDROID_SDK_ROOT=${androidComposition.androidsdk}/libexec/android-sdk \
--prefix ANDROID_HOME=${androidComposition.androidsdk}/libexec/android-sdk \
--prefix ANDROID_JAVA_HOME=${pkgs.jdk.home}
wrapProgram $out/bin/android-studio \
--prefix FLUTTER_SDK=${pkgs.flutter.unwrapped} \
--prefix ANDROID_SDKz_ROOT=${androidComposition.androidsdk}/libexec/android-sdk \
--prefix ANDROID_HOME=${androidComposition.androidsdk}/libexec/android-sdk \
--prefix ANDROID_JAVA_HOME=${pkgs.jdk.home}
'';
};
buildDeps = with pkgs; [ buildDeps = with pkgs; [
gtk3 gtk3
glib glib
@ -74,10 +50,10 @@
]; ];
nativeBuildDeps = with pkgs; [ nativeBuildDeps = with pkgs; [
flutter.unwrapped spFlutter
spFlutter.dart
bash bash
curl curl
flutter.dart
git git
unzip unzip
which which
@ -90,15 +66,14 @@
androidComposition.androidsdk androidComposition.androidsdk
openjdk11_headless openjdk11_headless
clang clang
xdg-user-dirs
]; ];
releaseDerivation = pkgs.flutter.mkFlutterApp rec { releaseDerivation = spFlutter.buildFlutterApplication rec {
pname = "selfprivacy"; pname = pubSpec.name;
version = "0.6.0"; version = pubSpec.version;
vendorHash = "sha256-7cbiAyIlaz3HqEsZN/nZxaLZjseJv5CmiIHqsoGa4ZI="; autoPubspecLock = ./pubspec.lock;
nativeBuildInputs = [ pkgs.nixgl.auto.nixGLDefault ];
src = ./.; src = ./.;
@ -109,9 +84,6 @@
}; };
postInstall = '' postInstall = ''
rm $out/bin/$pname
printf "#!/bin/sh\n${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL $out/app/${pname}" > $out/bin/$pname
patchShebangs $out/bin/$pname patchShebangs $out/bin/$pname
chmod +x $out/bin/$pname chmod +x $out/bin/$pname
wrapProgram $out/bin/$pname --set PATH ${pkgs.lib.makeBinPath [ pkgs.xdg-user-dirs ]} wrapProgram $out/bin/$pname --set PATH ${pkgs.lib.makeBinPath [ pkgs.xdg-user-dirs ]}

View file

@ -1403,10 +1403,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.4" version: "14.2.5"
watcher: watcher:
dependency: transitive dependency: transitive
description: description: